Initial commit

This commit is contained in:
Zhongwei Li
2025-11-29 18:03:12 +08:00
commit bc9ae138e4
28 changed files with 7069 additions and 0 deletions

41
commands/convert.md Normal file
View File

@@ -0,0 +1,41 @@
---
description: Convert markdown to PDF/DOCX/HTML with validation
argument-hint: <input> <output> [options]
allowed-tools: Bash, Read
disable-model-invocation: true
---
# /pandoc:convert - Convert Document
Ask Claude to validate and convert your markdown file.
## Quick Reference
**Basic conversions:**
```bash
pandoc document.md -o document.pdf
pandoc document.md -o document.html --standalone
pandoc document.md -o document.docx
```
**With citations:**
```bash
pandoc paper.md -o paper.pdf --citeproc --number-sections
```
**Custom options:**
```bash
pandoc doc.md -o doc.pdf --pdf-engine=xelatex -V geometry:margin=1.5in
```
## Common Issues
- Missing LaTeX: `sudo dnf install texlive-scheme-medium`
- Unicode errors: Use `--pdf-engine=xelatex`
- Citations not showing: Add `--citeproc` flag
## Ask Claude
"Validate and convert paper.md to PDF with citations"
"Convert this document to HTML with table of contents"
"Help me convert to PDF - it's giving errors"

49
commands/defaults.md Normal file
View File

@@ -0,0 +1,49 @@
---
description: Generate defaults file for consistent conversions
argument-hint: <format> [output-file]
allowed-tools: Bash, Write
disable-model-invocation: true
---
# /pandoc:defaults - Defaults File
Ask Claude to create a defaults file for project-wide settings.
## Quick Reference
**PDF Defaults:**
```yaml
from: markdown
to: pdf
pdf-engine: pdflatex
citeproc: true
number-sections: true
metadata:
fontsize: 12pt
geometry: margin=1in
```
**Use defaults:**
```bash
pandoc doc.md --defaults=defaults.yaml -o output.pdf
```
**Makefile Integration:**
```makefile
%.pdf: %.md defaults.yaml
pandoc $< --defaults=defaults.yaml -o $@
```
## Available Formats
- `pdf` - PDF with pdflatex
- `html` - Standalone HTML
- `docx` - Word documents
- `beamer` - PDF presentations
- `revealjs` - Web presentations
## Ask Claude
"Create a PDF defaults file for my project"
"Set up defaults for consistent conversions"
"Generate defaults for HTML output"

51
commands/frontmatter.md Normal file
View File

@@ -0,0 +1,51 @@
---
description: Add/update YAML frontmatter in markdown
argument-hint: <file> [template-type]
allowed-tools: Bash, Read, Write
disable-model-invocation: true
---
# /pandoc:frontmatter - Add Frontmatter
Ask Claude to add or update YAML frontmatter in your markdown file.
## Quick Reference
**Minimal Frontmatter:**
```yaml
---
title: "Document Title"
author: "Your Name"
date: "Date"
---
```
**Academic Paper:**
```yaml
---
title: "Research Paper"
author: "Student Name"
date: "November 2024"
bibliography: references.bib
csl: harvard.csl
documentclass: report
fontsize: 12pt
geometry: margin=1in
numbersections: true
toc: true
---
```
**Common Fields:**
- `title` - Document title
- `author` - Author name(s)
- `date` - Publication date
- `bibliography` - Path to .bib file
- `csl` - Citation style file
- `lang` - Language (en-GB, en-US)
## Ask Claude
"Add frontmatter to this markdown file"
"Update my document with academic template frontmatter"
"This file needs proper YAML frontmatter"

106
commands/help.md Normal file
View File

@@ -0,0 +1,106 @@
---
description: "Get help with the Pandoc plugin - available commands and quick start guide"
disable-model-invocation: true
---
# Pandoc Plugin Help
Quick reference for the Pandoc document conversion plugin.
## Available Commands
- `/pandoc:help` - This help message
- `/pandoc:template` - Generate document templates (academic, thesis, presentations)
- `/pandoc:validate` - Validate YAML frontmatter and dependencies
- `/pandoc:convert` - Convert documents with smart defaults
- `/pandoc:frontmatter` - Add or update document metadata
- `/pandoc:restyle` - Transform document to match different template styles
- `/pandoc:defaults` - Generate reusable defaults files
## Quick Start
### Ask Claude to help with:
**Simple conversion:**
> "Convert this markdown file to PDF"
**Academic papers:**
> "Format this as an academic paper with citations"
**Presentations:**
> "Turn this into a presentation"
**Document transformation:**
> "Restyle this document to match thesis format"
**Validation:**
> "Check if my document is ready to convert"
## Common Tasks
### Convert to PDF
Just ask: "Convert document.md to PDF"
### Add Bibliography
Just ask: "Add bibliography support to this document"
### Fix Errors
Just ask: "This conversion failed, what's wrong?"
### Apply Template
Just ask: "Format this as [academic paper / thesis / presentation]"
## When Things Go Wrong
Common issues and what to ask:
**YAML errors:**
> "The YAML frontmatter has errors, can you fix it?"
**Missing files:**
> "It says bibliography file is missing, help me set this up"
**LaTeX errors:**
> "The PDF conversion failed with a LaTeX error"
**Citation issues:**
> "Citations aren't showing up in the output"
## Templates Available
- **academic-paper** - Research papers with citations
- **thesis-report** - Thesis/dissertation with custom title page
- **article-simple** - Simple article format
- **presentation-beamer** - LaTeX Beamer slides
- **presentation-revealjs** - Web-based reveal.js slides
## How It Works
The plugin auto-activates when you ask about:
- Document conversion
- PDF generation
- Bibliography/citations
- Academic formatting
- Templates
Just describe what you want to do - no need to know Pandoc syntax!
## Examples
> "I have a markdown file about my research, can you convert it to PDF?"
> "This needs to be formatted as an academic paper with Harvard citations"
> "Can you check if this document is ready to convert?"
> "Transform this into thesis format with table of contents"
## Need More Help?
For detailed information, use specific commands:
- `/pandoc:template` - Template details
- `/pandoc:convert` - Conversion options
- `/pandoc:validate` - Validation guide
- `/pandoc:restyle` - Document transformation
Or just ask Claude naturally about what you're trying to accomplish!

108
commands/restyle.md Normal file
View File

@@ -0,0 +1,108 @@
---
description: Transform document to match target template style
argument-hint: <input> <target-style>
allowed-tools: Bash, Read, Write
disable-model-invocation: true
---
# /pandoc:restyle - Restyle Document
Ask Claude to transform a document's frontmatter and structure to match a target template style.
## Available Styles
- `academic-paper` - Academic paper with citations
- `thesis` - Thesis/report with title page
- `article` - Simple article
- `presentation-beamer` - PDF slides
- `presentation-reveal` - Web slides
## What It Does
1. Reads current document and analyzes frontmatter
2. Replaces frontmatter with target template style
3. Preserves all markdown content
4. Suggests structural improvements if needed
## Quick Reference
**OCR → Academic Paper:**
```yaml
# Before (OCR metadata)
---
title: "Document Title"
processed_date: "2025-11-15"
ocr_model: "model-name"
---
# After (Academic)
---
title: "Paper Title"
author: "Author Name"
date: "Month Year"
bibliography: references.bib
csl: harvard.csl
documentclass: report
fontsize: 12pt
geometry: margin=1in
numbersections: true
---
```
**Simple → Thesis:**
```yaml
# Before
---
title: "Document"
author: "Name"
---
# After
---
title: "Thesis Title"
author: "Student Name"
supervisor: "Supervisor Name"
institution: "University Name"
department: "Department Name"
degree: "Degree Name"
bibliography: references.bib
csl: harvard.csl
documentclass: report
toc: true
lof: true
lot: true
---
```
## Workflow
1. Backup: `cp document.md document.md.bak`
2. Ask Claude to restyle to target template
3. Review frontmatter changes
4. Edit custom fields (author, title, etc.)
5. Validate: Check document is ready
6. Convert: Generate output
## Ask Claude
"Restyle this document to match the thesis template"
"Transform this OCR output to academic paper format"
"Convert this to presentation style"
"Reformat this with proper academic frontmatter"
## Common Transformations
**Template from PDF/OCR:**
- Remove: `source`, `processed_date`, `ocr_model`, `processor`
- Add: `author`, `date`, `documentclass`, `geometry`
- Update: `title` to actual document title
**Blog/Draft → Academic:**
- Add: `bibliography`, `csl`, `documentclass`
- Add: `fontsize`, `geometry`, `numbersections`
- Structure: Academic section organization
**Article → Thesis:**
- Add: `supervisor`, `institution`, `department`, `degree`
- Add: `toc`, `lof`, `lot`
- Add: Abstract, Declaration, Acknowledgements sections

58
commands/template.md Normal file
View File

@@ -0,0 +1,58 @@
---
description: Generate document template with frontmatter
argument-hint: <type> [output-file]
allowed-tools: Bash, Read
disable-model-invocation: true
---
# /pandoc:template - Document Templates
Ask Claude to create a document from template.
## Available Templates
- `academic-paper` - Paper with citations
- `thesis` - Thesis/report with title page
- `presentation-beamer` - PDF slides
- `presentation-reveal` - Web slides
- `article` - Simple article
- `bibtex` - Bibliography examples
## Quick Reference
**YAML Frontmatter Example:**
```yaml
---
title: "Paper Title"
author: "Your Name"
date: "November 2024"
bibliography: references.bib
csl: harvard.csl
documentclass: report
fontsize: 12pt
geometry: margin=1in
---
```
**BibTeX Entry Example:**
```bibtex
@article{smith2024,
author = {Smith, John},
title = {Paper Title},
journal = {Journal Name},
year = {2024},
volume = {42},
pages = {123--145}
}
```
**Citation Syntax:**
```markdown
[@smith2024] or @smith2024 found that...
```
## Ask Claude
"Create an academic paper template"
"Show me the thesis template"
"Set up a new document with bibliography"

51
commands/validate.md Normal file
View File

@@ -0,0 +1,51 @@
---
description: Validate YAML frontmatter and dependencies
argument-hint: <file>
allowed-tools: Bash
disable-model-invocation: true
---
# /pandoc:validate - Validate Document
Ask Claude to check your document for errors before converting.
## What It Checks
- ✅ YAML syntax (spaces not tabs)
- ✅ Bibliography file exists
- ✅ CSL file exists
- ✅ Image files exist
- ✅ Required fields present
## Quick Reference
**Common YAML Errors:**
```yaml
# ❌ Wrong (tabs)
title:→"Paper"
# ✅ Correct (spaces)
title: "Paper"
# ❌ Wrong (missing quotes)
title: Paper: A Study
# ✅ Correct
title: "Paper: A Study"
```
**Required Structure:**
```yaml
---
title: "Title"
author: "Name"
---
# Content here
```
## Ask Claude
"Validate my document before converting"
"Check if this is ready to convert to PDF"
"Why won't my document convert?"