一键导入
markdown
Extract text and tables from Markdown (.md) files. Use when a user uploads a Markdown document that needs to be processed.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Extract text and tables from Markdown (.md) files. Use when a user uploads a Markdown document that needs to be processed.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Plan page-level PPT outlines, audience adaptation, and visual-mode semantics for the deck.
PPT visual production rules, local enhancements, and vendor skill composition for theme, assets, and slide generation.
Extract text and tables from Word (.docx) files. Use when a user uploads a Word document that needs to be processed.
Extract text and tables from PDF files. Use when a user uploads a PDF document that needs to be processed.
Extract text and tables from PowerPoint (.pptx) files. Use when a user uploads a PPTX presentation that needs to be processed.
Summarize and structure raw document text (PDF/Word) into a format optimized for PPT generation. Use when the user uploads a document and wants to generate a presentation from it.
| name | markdown |
| description | Extract text and tables from Markdown (.md) files. Use when a user uploads a Markdown document that needs to be processed. |
Extract readable text and structured tables from Markdown files. This skill feeds extracted content into downstream processing (e.g., document summarization for PPT generation).
.md fileMarkdown files are plain text — read directly with UTF-8 encoding.
with open("document.md", "r", encoding="utf-8") as f:
raw_text = f.read()
# Strip leading/trailing whitespace
raw_text = raw_text.strip()
Why direct read:
Markdown tables use pipe-delimited format. Extract tables as 2D arrays:
import re
def extract_markdown_tables(text: str) -> list[list[list[str]]]:
"""
Extract Markdown tables from text.
Markdown table format:
| Header 1 | Header 2 |
|----------|----------|
| Cell 1 | Cell 2 |
"""
tables = []
lines = text.split("\n")
in_table = False
current_table: list[list[str]] = []
for line in lines:
line = line.strip()
if not line.startswith("|"):
if current_table:
tables.append(current_table)
current_table = []
in_table = False
continue
# Skip separator rows (|---|)
if re.match(r"^\|[\s\-:|]+\|$", line):
continue
# Parse cells
cells = [cell.strip() for cell in line.strip("|").split("|")]
if cells:
current_table.append(cells)
in_table = True
if current_table:
tables.append(current_table)
return tables
When to extract tables:
Code blocks may contain important content. Detect and optionally flag:
code_block_pattern = r"```[\w]*\n(.*?)```"
code_blocks = re.findall(code_block_pattern, text, re.DOTALL)
inline_code_pattern = r"`([^`]+)`"
inline_codes = re.findall(inline_code_pattern, text)
| Problem | Solution |
|---|---|
| Non-UTF-8 encoding | Try encoding="utf-8-sig" (handles BOM) or encoding="gbk" |
| Empty file | Return empty string with table count 0 |
| Very large files | Read line-by-line, limit total characters (e.g., 100,000) |
| Mixed line endings | Normalize with text.replace("\r\n", "\n") |
| YAML frontmatter | Strip content between --- fences if present at top |
# Strip YAML frontmatter
def strip_frontmatter(text: str) -> str:
if text.startswith("---"):
end = text.find("\n---", 3)
if end != -1:
return text[end + 4:].lstrip()
return text
For PPT generation pipeline:
max(1, len(text) // 3000) (rough estimate based on character count)Return (raw_text: str, tables: list[list[list[str]]], estimated_pages: int):
raw_text: full markdown text, stripped of leading/trailing whitespacetables: list of extracted tables, each table is list[list[str]] (rows → cells); empty list if no tablesestimated_pages: rough page estimate based on character count