ai-html-generate
FreeNo executable scriptsNot checkedUse AI to recreate PDF page as semantic HTML. Consumes three inputs (PNG image, parsed text, ASCII preview) for complete contextual understanding and accurate…
by aiskillstore★ 509 GitHub starsAbout this skill
AI HTML Generate Skill
Purpose
This skill leverages AI's probabilistic generation capabilities to recreate PDF pages as semantic HTML. The AI receives three complementary inputs that together provide complete context:
- Visual reference (PNG image) - Page layout and visual hierarchy
- Text data (rich_extraction.json) - Accurate text content and formatting metadata
- Structural preview (ASCII text) - Logical layout and element relationships
This three-input approach ensures the AI understands not just what text to include, but how it should be structured semantically in HTML.
The output is probabilistic (AI-generated), but will be made deterministic by validation gates in subsequent skills.
What to Do
Prepare three input files
- Load
02_page_XX.png(image file) - Load
01_rich_extraction.json(text spans with metadata) - Load
03_page_XX_ascii.txt(structure preview)
- Load
Construct AI prompt
- Attach PNG image as visual reference
- Include extracted text data (JSON)
- Include ASCII preview (text representation)
- Provide specific generation requirements
Invoke Claude API with complete context
- Send multi-modal prompt (text + image)
- Request semantic HTML5 output
- Specify CSS classes and structure requirements
Parse and save generated HTML
- Extract HTML from AI response
- Validate basic well-formedness
- Save to persistent file with metadata
Log generation metadata
- Record AI model used
- Timestamp generation
- List input files used
- Store any confidence indicators from AI
Input Files (From Previous Skills)
Input 1: Rendered PDF Page (PNG)
File: output/chapter_XX/page_artifacts/page_YY/02_page_XX.png
- High-resolution rendering of PDF page
- 300+ DPI for visual clarity
- Shows actual page appearance
- Used for visual layout understanding
Input 2: Rich Extraction Data (JSON)
File: output/chapter_XX/page_artifacts/page_YY/01_rich_extraction.json
- Text spans with complete metadata
- Font names, sizes, bold/italic flags
- Position information (bounding boxes)
- Sequence and relationships
Input 3: ASCII Preview (Text)
File: output/chapter_XX/page_artifacts/page_YY/03_page_XX_ascii.txt
- Text-based structural representation
- Heading hierarchy marked
- Lists and bullets identified
- Paragraph flow documented
- Element types annotated
AI Prompt Template
The prompt sent to Claude:
You are recreating a PDF textbook page as semantic HTML5.
You have three pieces of information about this page:
1. A visual rendering (PNG image) - to understand layout
2. Parsed text data (JSON) - to ensure accuracy
3. An ASCII structure preview (text) - to understand element relationships
VISUAL REFERENCE:
[PNG Image Attached]
PARSED TEXT DATA:
[JSON Attached]
STRUCTURAL PREVIEW:
[ASCII Text Attached]
TASK:
Generate semantic HTML5 that accurately recreates this page.
REQUIREMENTS:
1. HTML5 Structure:
- Proper DOCTYPE, html, head, body tags
- Meta charset="UTF-8"
- Meta viewport for responsive design
- Title tag with descriptive text
2. Content Wrapper:
- Single <div class="page-container"> wrapper
- Single <main class="page-content"> for all content
- No page breaks or paginated structure
3. Semantic HTML Elements:
- Use proper heading tags (h1-h6) based on hierarchy
- Use <p> for paragraphs
- Use <ul> and <li> for bullet lists
- Use <table> if data tables present
- Use <figure> and <figcaption> for images/exhibits
4. Semantic CSS Classes:
Apply these classes based on detected element types:
Page Structure:
- page-container (main wrapper)
- page-content (content area)
- chapter-header (chapter opening section)
- chapter-number (numeric chapter marker)
- chapter-title (chapter main title)
Content Elements:
- section-heading (major section, h2)
- subsection-heading (minor section, h3-h4)
- paragraph (body text, p)
- bullet-list (ul)
- bullet-item (li)
Navigation & Structure:
- section-navigation (list of topics/sections)
- nav-item (individual nav item)
- section-divider (hr divider line)
Special Elements:
- exhibit (table or figure)
- exhibit-table (actual table)
- exhibit-title (figure/table caption)
- image-placeholder (for embedded images)
5. Content Preservation & Boundary Integrity:
- Include ALL text content from the parsed data
- Preserve exact text (no paraphrasing or edits)
- Maintain original structure and relationships
- Do not omit or skip sections
CRITICAL - PAGE BOUNDARY RULES:
- Start page content EXACTLY where JSON starts it
- End page content EXACTLY where JSON ends it
- NEVER add bridging text, connectors, or completing phrases
- NEVER invent transitional words or sentences
- NEVER synthesize content to "smooth" page transitions
- Pages may start or end mid-sentence - this is EXPECTED and
Install ai-html-generate in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
FAQ
What does the ai-html-generate skill do?
Use AI to recreate PDF page as semantic HTML. Consumes three inputs (PNG image, parsed text, ASCII preview) for complete contextual understanding and accurate generation.
How do I install the ai-html-generate skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the ai-html-generate skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
by AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
by Anthropicxlsx
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
by Anthropicpptx
Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…
by Anthropic