{"data":{"slug":"github-claude-office-skills-skills-md-to-office-2c75b7ab901f","title":"Markdown to Office Document Conversion","summary":"Convert Markdown files to Word, PowerPoint, and PDF formats using Pandoc with styling and metadata support. Requires LaTeX or wkhtmltopdf for PDF conversion.","url":"https:\/\/skillshunter.net\/skills\/github-claude-office-skills-skills-md-to-office-2c75b7ab901f","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-claude-office-skills-skills-md-to-office-2c75b7ab901f","markdown_url":"https:\/\/skillshunter.net\/skills\/github-claude-office-skills-skills-md-to-office-2c75b7ab901f.md","download_url":"https:\/\/skillshunter.net\/skills\/github-claude-office-skills-skills-md-to-office-2c75b7ab901f\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"Requires LaTeX installation for PDF conversion. Use a reference template for consistent styling in Word and PowerPoint. YAML frontmatter can be used to add metadata such as title, author, and document formatting options.","instructions":"---\n# \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n# CLAUDE OFFICE SKILL - Enhanced Metadata v2.0\n# \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n\n# Basic Information\nname: md-to-office\ndescription: \">\"\nversion: \"1.0\"\nauthor: claude-office-skills\nlicense: MIT\n\n# Categorization\ncategory: conversion\ntags:\n  - markdown\n  - conversion\n  - office\n  - pandoc\ndepartment: All\n\n# AI Model Compatibility\nmodels:\n  recommended:\n    - claude-sonnet-4\n    - claude-opus-4\n  compatible:\n    - claude-3-5-sonnet\n    - gpt-4\n    - gpt-4o\n\n# MCP Tools Integration\nmcp:\n  server: office-mcp\n  tools:\n    - md_to_docx\n    - md_to_pptx\n\n# Skill Capabilities\ncapabilities:\n  - markdown_conversion\n  - document_generation\n\n# Language Support\nlanguages:\n  - en\n  - zh\n---\n\n# Markdown to Office Skill\n\n## Overview\n\nThis skill enables conversion from Markdown to various Office formats using **Pandoc** - the universal document converter. Convert your Markdown files to professional Word documents, PowerPoint presentations, PDFs, and more while preserving formatting and structure.\n\n## How to Use\n\n1. Provide the Markdown content or file\n2. Specify the target format (docx, pptx, pdf, etc.)\n3. Optionally provide a reference template for styling\n4. I'll convert using Pandoc with optimal settings\n\n**Example prompts:**\n- \"Convert this README.md to a professional Word document\"\n- \"Turn my markdown notes into a PowerPoint presentation\"\n- \"Generate a PDF from this markdown with custom styling\"\n- \"Create a Word doc from this markdown using company template\"\n\n## Domain Knowledge\n\n### Pandoc Fundamentals\n\n```bash\n# Basic conversion\npandoc input.md -o output.docx\npandoc input.md -o output.pdf\npandoc input.md -o output.pptx\n\n# With template\npandoc input.md --reference-doc=template.docx -o output.docx\n\n# Multiple inputs\npandoc ch1.md ch2.md ch3.md -o book.docx\n```\n\n### Supported Conversions\n\n| From | To | Command |\n|------|-----|---------|\n| Markdown | Word | `pandoc in.md -o out.docx` |\n| Markdown | PDF | `pandoc in.md -o out.pdf` |\n| Markdown | PowerPoint | `pandoc in.md -o out.pptx` |\n| Markdown | HTML | `pandoc in.md -o out.html` |\n| Markdown | LaTeX | `pandoc in.md -o out.tex` |\n| Markdown | EPUB | `pandoc in.md -o out.epub` |\n\n### Markdown to Word (.docx)\n\n#### Basic Conversion\n```bash\npandoc document.md -o document.docx\n```\n\n#### With Template (Reference Doc)\n```bash\n# First create a template by converting sample\npandoc sample.md -o reference.docx\n\n# Edit reference.docx styles in Word, then use it\npandoc input.md --reference-doc=reference.docx -o output.docx\n```\n\n#### With Table of Contents\n```bash\npandoc document.md --toc --toc-depth=3 -o document.docx\n```\n\n#### With Metadata\n```bash\npandoc document.md \\\n  --metadata title=\"My Report\" \\\n  --metadata author=\"John Doe\" \\\n  --metadata date=\"2024-01-15\" \\\n  -o document.docx\n```\n\n### Markdown to PDF\n\n#### Via LaTeX (Best Quality)\n```bash\n# Requires LaTeX installation\npandoc document.md -o document.pdf\n\n# With custom settings\npandoc document.md \\\n  --pdf-engine=xelatex \\\n  -V geometry:margin=1in \\\n  -V fontsize=12pt \\\n  -o document.pdf\n```\n\n#### Via HTML\/wkhtmltopdf\n```bash\npandoc document.md \\\n  --pdf-engine=wkhtmltopdf \\\n  --css=style.css \\\n  -o document.pdf\n```\n\n#### PDF Options\n```bash\npandoc document.md \\\n  -V papersize:a4 \\\n  -V geometry:margin=2cm \\\n  -V fontfamily:libertinus \\\n  -V colorlinks:true \\\n  --toc \\\n  -o document.pdf\n```\n\n### Markdown to PowerPoint (.pptx)\n\n#### Basic Conversion\n```bash\npandoc slides.md -o presentation.pptx\n```\n\n#### Markdown Structure for Slides\n```markdown\n---\ntitle: Presentation Title\nauthor: Author Name\ndate: January 2024\n---\n\n# Section Header (creates section divider)\n\n## Slide Title\n\n- Bullet point 1\n- Bullet point 2\n  - Sub-bullet\n\n## Another Slide\n\nContent here\n\n::: notes\nSpeaker notes go here (not visible in slides)\n:::\n\n## Slide with Image\n\n![Description](image.png){width=80%}\n\n## Two Column Slide\n\n:::::::::::::: {.columns}\n::: {.column width=\"50%\"}\nLeft column content\n:::\n\n::: {.column width=\"50%\"}\nRight column content\n:::\n::::::::::::::\n```\n\n#### With Template\n```bash\n# Use corporate PowerPoint template\npandoc slides.md --reference-doc=template.pptx -o presentation.pptx\n```\n\n### YAML Frontmatter\n\nAdd metadata at the top of your Markdown:\n\n```yaml\n---\ntitle: \"Document Title\"\nauthor: \"Author Name\"\ndate: \"2024-01-15\"\nabstract: \"Brief description\"\ntoc: true\ntoc-depth: 2\nnumbersections: true\ngeometry: margin=1in\nfontsize: 11pt\ndocumentclass: report\n---\n\n# First Chapter\n...\n```\n\n### Python Integration\n\n```python\nimport subprocess\nimport os\n\ndef md_to_docx(input_path, output_path, template=None):\n    \"\"\"Convert Markdown to Word document.\"\"\"\n    cmd = ['pandoc', input_path, '-o', output_path]\n    \n    if template:\n        cmd.extend(['--reference-doc', template])\n    \n    subprocess.run(cmd, check=True)\n    return output_path\n\ndef md_to_pdf(input_path, output_path, **options):\n    \"\"\"Convert Markdown to PDF with options.\"\"\"\n    cmd = ['pandoc', input_path, '-o', output_path]\n    \n    if options.get('toc'):\n        cmd.append('--toc')\n    \n    if options.get('margin'):\n        cmd.extend(['-V', f\"geometry:margin={options['margin']}\"])\n    \n    subprocess.run(cmd, check=True)\n    return output_path\n\ndef md_to_pptx(input_path, output_path, template=None):\n    \"\"\"Convert Markdown to PowerPoint.\"\"\"\n    cmd = ['pandoc', input_path, '-o', output_path]\n    \n    if template:\n        cmd.extend(['--reference-doc', template])\n    \n    subprocess.run(cmd, check=True)\n    return output_path\n```\n\n### pypandoc (Python Wrapper)\n\n```python\nimport pypandoc\n\n# Simple conversion\noutput = pypandoc.convert_file('input.md', 'docx', outputfile='output.docx')\n\n# With options\noutput = pypandoc.convert_file(\n    'input.md', \n    'docx',\n    outputfile='output.docx',\n    extra_args=['--toc', '--reference-doc=template.docx']\n)\n\n# From string\nmd_content = \"# Hello\\n\\nThis is markdown.\"\noutput = pypandoc.convert_text(md_content, 'docx', format='md', outputfile='output.docx')\n```\n\n## Best Practices\n\n1. **Use Templates**: Create a reference document for consistent branding\n2. **Structure Headers**: Use consistent heading levels (## for slides, # for sections)\n3. **Test Incrementally**: Convert small sections first to verify formatting\n4. **Include Metadata**: Use YAML frontmatter for document properties\n5. **Handle Images**: Use relative paths and specify dimensions\n\n## Common Patterns\n\n### Batch Conversion\n```python\nimport subprocess\nfrom pathlib import Path\n\ndef batch_convert(input_dir, output_format, output_dir=None):\n    \"\"\"Convert all markdown files in a directory.\"\"\"\n    input_path = Path(input_dir)\n    output_path = Path(output_dir) if output_dir else input_path\n    \n    for md_file in input_path.glob('*.md'):\n        output_file = output_path \/ md_file.with_suffix(f'.{output_format}').name\n        subprocess.run([\n            'pandoc', str(md_file), '-o', str(output_file)\n        ], check=True)\n        print(f\"Converted: {md_file.name} -> {output_file.name}\")\n\nbatch_convert('.\/docs', 'docx', '.\/output')\n```\n\n### Report Generator\n```python\ndef generate_report(title, sections, output_path, template=None):\n    \"\"\"Generate Word report from structured data.\"\"\"\n    \n    # Build markdown\n    md_content = f\"\"\"---\ntitle: \"{title}\"\ndate: \"{datetime.now().strftime('%B %d, %Y')}\"\n---\n\n\"\"\"\n    for section_title, content in sections.items():\n        md_content += f\"# {section_title}\\n\\n{content}\\n\\n\"\n    \n    # Write temp file\n    with open('temp_report.md', 'w') as f:\n        f.write(md_content)\n    \n    # Convert\n    cmd = ['pandoc', 'temp_report.md', '-o', output_path, '--toc']\n    if template:\n        cmd.extend(['--reference-doc', template])\n    \n    subprocess.run(cmd, check=True)\n    os.remove('temp_report.md')\n```\n\n## Examples\n\n### Example 1: Technical Documentation\n```python\nimport subprocess\n\n# Create comprehensive markdown\ndoc = \"\"\"---\ntitle: \"API Documentation\"\nauthor: \"Dev Team\"\ndate: \"2024-01-15\"\ntoc: true\ntoc-depth: 2\n---\n\n# Introduction\n\nThis document describes the REST API for our service.\n\n## Authentication\n\nAll API requests require an API key in the header:\n\n```\nAuthorization: Bearer YOUR_API_KEY\n```\n\n## Endpoints\n\n### GET \/users\n\nRetrieve all users.\n\n**Response:**\n\n| Field | Type | Description |\n|-------|------|-------------|\n| id | integer | User ID |\n| name | string | Full name |\n| email | string | Email address |\n\n### POST \/users\n\nCreate a new user.\n\n**Request Body:**\n\n```json\n{\n  \"name\": \"John Doe\",\n  \"email\": \"john@example.com\"\n}\n```\n\n## Error Codes\n\n| Code | Meaning |\n|------|---------|\n| 400 | Bad Request |\n| 401 | Unauthorized |\n| 404 | Not Found |\n| 500 | Server Error |\n\"\"\"\n\n# Save markdown\nwith open('api_docs.md', 'w') as f:\n    f.write(doc)\n\n# Convert to Word\nsubprocess.run([\n    'pandoc', 'api_docs.md',\n    '-o', 'api_documentation.docx',\n    '--toc',\n    '--reference-doc', 'company_template.docx'\n], check=True)\n\n# Convert to PDF\nsubprocess.run([\n    'pandoc', 'api_docs.md',\n    '-o', 'api_documentation.pdf',\n    '--toc',\n    '-V', 'geometry:margin=1in',\n    '-V', 'fontsize=11pt'\n], check=True)\n```\n\n### Example 2: Presentation from Markdown\n```python\nslides_md = \"\"\"---\ntitle: \"Q4 Business Review\"\nauthor: \"Sales Team\"\ndate: \"January 2024\"\n---\n\n# Overview\n\n## Agenda\n\n- Q4 Performance Summary\n- Regional Highlights\n- 2024 Outlook\n- Q&A\n\n# Q4 Performance\n\n## Key Metrics\n\n- Revenue: $12.5M (+15% YoY)\n- New Customers: 250\n- Retention Rate: 94%\n\n## Regional Performance\n\n:::::::::::::: {.columns}\n::: {.column width=\"50%\"}\n**North America**\n\n- Revenue: $6.2M\n- Growth: +18%\n:::\n\n::: {.column width=\"50%\"}\n**Europe**\n\n- Revenue: $4.1M\n- Growth: +12%\n:::\n::::::::::::::\n\n# 2024 Outlook\n\n## Strategic Priorities\n\n1. Expand APAC presence\n2. Launch new product line\n3. Improve customer onboarding\n\n## Revenue Targets\n\n| Quarter | Target |\n|---------|--------|\n| Q1 | $13M |\n| Q2 | $14M |\n| Q3 | $15M |\n| Q4 | $16M |\n\n# Thank You\n\n## Questions?\n\nContact: sales@company.com\n\"\"\"\n\nwith open('presentation.md', 'w') as f:\n    f.write(slides_md)\n\nsubprocess.run([\n    'pandoc', 'presentation.md',\n    '-o', 'q4_review.pptx',\n    '--reference-doc', 'company_slides.pptx'\n], check=True)\n```\n\n## Limitations\n\n- Complex Word formatting may not convert perfectly\n- PDF conversion requires LaTeX or wkhtmltopdf\n- PowerPoint animations not supported\n- Some advanced tables may need manual adjustment\n- Image positioning can be tricky\n\n## Installation\n\n```bash\n# macOS\nbrew install pandoc\n\n# Ubuntu\/Debian\nsudo apt-get install pandoc\n\n# Windows\nchoco install pandoc\n\n# Python wrapper\npip install pypandoc\n```\n\n## Resources\n\n- [Pandoc User's Guide](https:\/\/pandoc.org\/MANUAL.html)\n- [GitHub Repository](https:\/\/github.com\/jgm\/pandoc)\n- [Pandoc Templates](https:\/\/github.com\/jgm\/pandoc-templates)\n- [pypandoc Documentation](https:\/\/github.com\/JessicaTegworthy\/pypandoc)\n","use_cases":["Convert README.md to professional Word document","Generate PDF presentation from markdown notes","Create PowerPoint slides from markdown content"],"limitations":[],"compatibility":[],"setup_tip":"```bash\n# macOS\nbrew install pandoc\n\n# Ubuntu\/Debian\nsudo apt-get install pandoc\n\n# Windows\nchoco install pandoc\n\n# Python wrapper\npip install pypandoc\n```","sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/claude-office-skills\/skills\/blob\/9c4c7d5cd2813a8936bf2c9fdb174ea883b85a11\/md-to-office\/SKILL.md","source_commit":"9c4c7d5cd2813a8936bf2c9fdb174ea883b85a11","license":"MIT","version":null,"listing_approved_at":"2026-11-22","created_at":"2026-11-21T14:25:05.000000Z","updated_at":"2026-11-22T11:18:09.000000Z","seo_title":"Markdown to Office Conversion Tool","seo_description":"Convert Markdown to Word, PowerPoint, and PDF with Pandoc. Preserve formatting and add metadata.","seo_keywords":["markdown to word converter","markdown to pdf converter","markdown to powerpoint","pandoc document conversion","markdown to office tool"]}}