markdown2PNG / schema.md
broadfield-dev's picture
Update schema.md
30333e3 verified
# Supported Format Schemas
This document outlines the specific structures the Intelligent Markdown Converter looks for to detect and parse different types of documents into selectable components.
---
## 1. Repo2Markdown Format
**Purpose:** To represent a project's directory structure and the full contents of its files in a single document.
**Schema Rules:**
1. The document **must** contain a second-level heading exactly named \`## File Structure\`.
2. The document **must** contain at least one file block, denoted by a third-level heading starting with \`### File:\`.
3. For proper syntax highlighting, code files should have their content wrapped in fenced code blocks (e.g., \`\`\`python ... \`\`\`).
---
## 2. Standard README Format
**Purpose:** To parse a typical software project \`README.md\` file into its major sections.
**Schema Rules:**
1. The document **must** start with a top-level heading (\`#\`).
2. The document **must** contain at least one second-level heading (\`##\`). Each \`##\` heading and its content becomes a "Section" component.
---
## 3. Changelog Format
**Purpose:** To parse a standard "Keep a Changelog" formatted file into components for each version.
**Schema Rules:**
1. The document **must** contain at least one version heading that follows the pattern: \`## [VersionNumber] - YYYY-MM-DD\`.
2. Each version heading and its content becomes a "Version" component.
---
## 4. Agent Action Format
**Purpose:** To describe a series of programmatic actions and file manipulations for an agent to take on a Hugging Face Space.
**Schema Rules:**
1. The document is detected by the presence of a \`### HF_ACTION:\` command or the specific header text "File and Code Formatting:".
2. **File definitions** use the format \`### File: path/to/filename.ext\`, followed by a fenced code block or a binary file marker. These become "File" components.
3. **File structure definitions** use the heading \`## File Structure\`, followed by a fenced code block. This becomes a "Structure" component.
4. **Agent commands** are specified on a single line starting with \`### HF_ACTION: COMMAND arguments...\`. Each command becomes an "Action" component.
5. All other text is grouped into an "Instructions & Rules" component.
**Example:**
\`\`\`markdown
**File and Code Formatting:**
When you provide NEW code...
...
**Hugging Face Space Actions:**
...
### HF_ACTION: DELETE_FILE old_app.py
### File: new_app.py (A new application file)
\`\`\`python
# The new code for the application
print("This is the new app.")
\`\`\`
## File Structure
\`\`\`
πŸ“ Root
πŸ“„ new_app.py
\`\`\`
\`\`\`
---
## 5. Unknown Format
If your document does not match any of the schemas above, it will be classified as **"Unknown"**. The entire document will be treated as a single component and will be rendered as-is.