# panache TODO
This document tracks implementation status for panache's features.
**Status Legend**
- â
**Implemented** - Feature is fully or mostly implemented
- đ§ **Partial** - Feature is partially implemented or needs work
- â **Not Implemented** - Feature not yet started
- âšī¸ **Won't Implement** - Feature intentionally not implemented
---
## Language Server Protocol (LSP)
### Core LSP Capabilities
- â
`textDocument/formatting` - Full document formatting
- â
`textDocument/didOpen` - Track document opens
- â
`textDocument/didChange` - Track document changes (incremental sync)
- â
`textDocument/didClose` - Track document closes
- â
Configuration discovery from workspace root (`.panache.toml`)
### Future LSP Features
#### Diagnostics
- â **Syntax error diagnostics** - Report parsing errors as diagnostics
- â **Lint warnings** - Configurable linting rules (e.g., heading levels, list consistency)
- â **Link validation** - Check for broken internal links/references
- â **Citation validation** - Validate citation keys against bibliography
- â **Footnote validation** - Check for undefined footnotes
#### Code Actions
- â **Convert lists** - Convert between bullet/ordered lists
- â **Convert table** - Convert between table styles (simple, pipe, grid)
- â **Convert link styles** - Convert between inline/reference links
- â **Convert footnote styles** - Convert between inline/reference footnotes
#### Navigation & Symbols
- â
**Document outline** - `textDocument/documentSymbol` for headings, tables, figures
- â **Folding ranges** - `textDocument/foldingRange` for headings, lists, code blocks
- â **Go to definition** - Jump to reference link/footnote/citation definitions
- â **Find references** - Find all uses of a reference link/footnote/citation
#### Completion
- â **Citation completion** - `textDocument/completion` for `@cite` keys from bibliography
- â **Reference link completion** - Complete `[text][ref]` from defined references
- â **Heading link completion** - Complete internal links to headings
- â **Attribute completion** - Complete class names and attributes in `{.class #id}`
#### Hover Information
- â **Link preview** - `textDocument/hover` to show link target
- â **Reference preview** - Show reference definition on hover
- â **Citation preview** - Show bibliography entry for citation
- â **Footnote preview** - Show footnote content inline
#### Advanced
- â
**Range formatting** - `textDocument/rangeFormatting` for selected text only
- â **On-type formatting** - `textDocument/onTypeFormatting` for auto-formatting triggers
- â **Document links** - `textDocument/documentLink` for clickable links
- â **Semantic tokens** - Syntax highlighting via LSP
- â **Rename** - Rename reference links/footnotes/citations across document
- â **Workspace symbols** - Search for headings across all workspace documents
- â **Configuration via LSP** - `workspace/didChangeConfiguration` to reload config
---
## Configuration System
### Current Features
- â
Hierarchical config loading (explicit â local â XDG â defaults)
- â
Auto-detect flavor from file extension (.qmd â Quarto, .Rmd â RMarkdown)
- â
`flavor` config field affects .md files and stdin
- â
Global `[extensions]` overrides for all flavors
- â
`[formatters]` configuration for external code formatters
### Future Enhancements
#### Per-Flavor Extension Configuration
- â **Per-flavor extension overrides** - `[extensions.gfm]`, `[extensions.quarto]`, `[extensions.rmarkdown]`, etc.
- Allow fine-grained control of extensions for specific flavors
- Example: Enable `task_lists` only for GFM, disable `citations` for CommonMark
- Falls back to global `[extensions]` settings when not specified
#### Per-File Pattern Overrides
- â **Glob pattern flavor overrides** - `[flavor_overrides]` with file patterns
- Override flavor for specific files or patterns
- Example: `"README.md" = "gfm"` or `"docs/**/*.md" = "gfm"`
- Useful for projects with mixed Markdown files (e.g., README.md as GFM, docs as Pandoc)
- Could potentially extend to per-pattern extension overrides: `[pattern_overrides."docs/**/*.md".extensions]`
---
## Linter
### Current Status
**â
Implemented** - Basic linter with CLI and one rule.
**Current features:**
- â
`panache lint` CLI subcommand
- â
`--check` mode for CI (exit 1 if violations found)
- â
`--fix` mode for auto-fixing violations
- â
Diagnostic output with file locations
- â
Pluggable rule system with `RuleRegistry`
- â
**Implemented rule:** `heading-hierarchy` - Warns when heading levels are skipped (e.g., h1 â h3)
### Architecture
Follows the ruff/clippy pattern: separate concerns, shared infrastructure
```
src/linter/ # Core linting logic
âââ rules/ # Individual lint rules
â âââ heading_hierarchy.rs # Heading level checking
âââ diagnostics.rs # Diagnostic types (Diagnostic, Severity, Fix, Edit)
âââ rules.rs # Rule trait and registry
âââ runner.rs # Rule execution
src/main.rs # CLI: `panache lint` subcommand
src/lsp.rs # LSP: TODO - integrate diagnostics
```
Both linter and formatter:
- â
Share the same parser and AST
- â
Use the same config system
- â
Benefit from rowan's CST
### CLI Commands
```bash
panache lint document.qmd # Report violations
panache lint --fix document.qmd # Auto-fix what's possible
panache lint --check document.qmd # CI mode: exit non-zero if violations
panache lint --config cfg.toml # Custom config
```
### Future Lint Rules
**Syntax correctness:**
- â Malformed fenced divs (unclosed, invalid attributes)
- â Broken table structures
- â Invalid citation syntax (`@citekey` malformations)
- â Unclosed inline math/code spans
- â Invalid shortcode syntax (Quarto-specific)
**Style/Best practices:**
- â
Inconsistent heading hierarchy (skip levels)
- â Multiple top-level headings
- â Empty links/images
- â Duplicate reference labels
- â Unused reference definitions
- â Hard-wrapped text in code blocks
**Configuration:**
- â Per-rule enable/disable in `.panache.toml` `[lint]` section
- â Severity levels (error, warning, info)
- â Auto-fix capability per rule (infrastructure exists, rules need implementation)
### Next Steps
- [ ] Add more lint rules (empty links, duplicate refs, etc.)
- [ ] Make rules configurable via `[lint]` section in config
- [ ] LSP integration with `textDocument/publishDiagnostics`
- [ ] Add auto-fix implementations for fixable rules
### Open Questions
- Should linter rules be pluggable (external crates)?
- How to balance parser error recovery vs. strict linting?
- Performance: incremental linting for LSP mode?
## Formatter
### Lists
- â
**Bullet lists** - Standardize bullet list markers to `-` (all `*`, `+`, `-` converted to `-`)
### Tables
- â **Simple tables** - Support for formatting tables
- â
**Pipe tables** - Support for formatting GitHub-style tables
- â **Grid tables** - Support for formatting grid-style tables
- â **Multiline tables** - Support for formatting tables with multiline cells
Parser - Comprehensive Pandoc Feature Coverage
This section tracks implementation status of Pandoc Markdown features based on the spec files in `docs/pandoc-spec/`.
**Focus**: Initial development prioritizes **default Pandoc extensions**. Non-default extensions are tracked separately for future consideration.
### Block-Level Elements
### Paragraphs â
- â
Basic paragraphs
- â
Paragraph wrapping/reflow
- â
Extension: `escaped_line_breaks` (backslash at line end)
### Headings â
- â
ATX-style headings (`# Heading`)
- â
Setext-style headings (underlined with `===` or `---`)
- â
Heading identifier attributes (`# Heading {#id}`)
- â
Extension: `blank_before_header` - Require blank line before headings (default behavior)
- â
Extension: `header_attributes` - Full attribute syntax `{#id .class key=value}`
- âšī¸ Extension: `implicit_header_references` - Auto-generate reference links (conversion feature, not formatting concern)
### Block Quotations â
- â
Basic block quotes (`> text`)
- â
Nested block quotes (`> > nested`)
- â
Block quotes with paragraphs
- â
Extension: `blank_before_blockquote` - Require blank before quote (default behavior)
- â
Block quotes containing lists
- â
Block quotes containing code blocks
### Lists đ§
- â
Bullet lists (`-`, `+`, `*`)
- â
Ordered lists (`1.`, `2.`, etc.)
- â
Nested lists
- â
List item continuation
- đ§ Complex nested mixed lists (fragile, needs parser structure improvement)
- â
Extension: `fancy_lists` - Roman numerals, letters `(a)`, `A)`, etc.
- â Extension: `startnum` - Start ordered lists at arbitrary number (low priority)
- â
Extension: `example_lists` - Example lists with `(@)` markers
- â
Extension: `task_lists` - GitHub-style `- [ ]` and `- [x]`
- â
Extension: `definition_lists` - Term/definition syntax
### Code Blocks â
- â
Fenced code blocks (backticks and tildes)
- â
Code block attributes (language, etc.)
- â
Indented code blocks (4-space indent)
- â
Extension: `fenced_code_attributes` - `{.language #id}`
- â
Extension: `backtick_code_blocks` - Backtick-only fences
- â
Extension: `inline_code_attributes` - Attributes on inline code
### Horizontal Rules â
- â
Basic horizontal rules (`---`, `***`, `___`)
### Fenced Divs â
- â
Basic fenced divs (`::: {.class}`)
- â
Nested fenced divs
- â
Colon count normalization based on nesting
- â
Proper formatting with attribute preservation
### Tables â
- â
Extension: `simple_tables` - Simple table syntax (parsing complete, formatting deferred)
- â
Extension: `table_captions` - Table captions (both before and after tables)
- â
Extension: `pipe_tables` - GitHub/PHP Markdown tables (all alignments, orgtbl variant)
- â
Extension: `multiline_tables` - Multiline cell content (parsing complete, formatting deferred)
- â
Extension: `grid_tables` - Grid-style tables (parsing complete, formatting deferred)
### Line Blocks â
- â
Extension: `line_blocks` - Poetry/verse with `|` prefix
---
## Inline Elements
### Emphasis & Formatting â
- â
`*italic*` and `_italic_`
- â
`**bold**` and `__bold__`
- â
Nested emphasis (e.g., `***bold italic***`)
- â
Overlapping and adjacent emphasis handling
- â
Extension: `intraword_underscores` - `snake_case` handling
- â
Extension: `strikeout` - `~~strikethrough~~`
- â
Extension: `superscript` - `^super^`
- â
Extension: `subscript` - `~sub~`
- â
Extension: `bracketed_spans` - Small caps `[text]{.smallcaps}`, underline `[text]{.underline}`, etc.
### Code & Verbatim â
- â
Inline code (`` `code` ``)
- â
Multi-backtick code spans (``` `` ` `` ```)
- â
Code spans containing backticks
- â
Proper whitespace preservation in code spans
- â
Fenced code blocks (``` and ~~~)
- â
Indented code blocks\*\* (4 spaces or 1 tab)
### Links â
- â
Inline links `[text](url)`
- â
Automatic links `<http://example.com>`
- â
Nested inline elements in link text (code, emphasis, math)
- â
Reference links `[text][ref]`
- â
Extension: `shortcut_reference_links` - `[ref]` without second `[]`
- â
Extension: `link_attributes` - `[text](url){.class}`
- âšī¸ Extension: `implicit_header_references` - `[Heading Name]` links to header (conversion feature, not formatting concern)
### Images â
- â
Inline images ``
- â
Nested inline elements in alt text (code, emphasis, math)
- â
Reference images `![alt][ref]`
- â
Image attributes `{#id .class key=value}`
- âšī¸ Extension: `implicit_figures` - Conversion feature, not formatting concern
### Math â
- â
Inline math `$x = y$`
- â
Display math `$$equation$$`
- â
Multi-dollar math spans (e.g., `$$$ $$ $$$`)
- â
Math containing special characters
- â
Extension: `tex_math_dollars` - Dollar-delimited math
### Footnotes â
- â
Inline footnotes `^[note text]`
- â
Reference footnotes `[^1]` with definition block
- â
Extension: `inline_notes` - Inline note syntax
- â
Extension: `footnotes` - Reference-style footnotes
### Citations â
- â
Extension: `citations` - `[@cite]` and `@cite` syntax with complex key support
### Spans â
- â
Extension: `bracketed_spans` - `[text]{.class}` inline
- â
Extension: `native_spans` - HTML `<span>` elements with markdown content
---
## Metadata & Front Matter
### Metadata Blocks â
- â
Extension: `yaml_metadata_block` - YAML frontmatter
- â
Extension: `pandoc_title_block` - Title/author/date at top
---
## Raw Content & Special Syntax
### Raw HTML â
- â
Extension: `raw_html` - Inline and block HTML
- â Extension: `markdown_in_html_blocks` - Markdown inside HTML blocks
### Raw LaTeX â
- â
Extension: `raw_tex` - Inline LaTeX commands (`\cite{ref}`, `\textbf{text}`, etc.)
- â
Extension: `raw_tex` - Block LaTeX environments (`\begin{tabular}...\end{tabular}`)
- âšī¸ Extension: `latex_macros` - Expand LaTeX macros (conversion feature, not formatting concern)
### Other Raw
- â
Extension: `raw_attribute` - Generic raw blocks `{=format}` (blocks â
, inline spans â
)
---
## Escapes & Special Characters
### Backslash Escapes â
- â
Extension: `all_symbols_escapable` - Backslash escapes any symbol
- â
Extension: `angle_brackets_escapable` - Escape `<` and `>`
- â
Escape sequences in inline elements (emphasis, code, math)
### Line Breaks â
- â
Extension: `escaped_line_breaks` - Backslash at line end = `<br>`
---
## Non-Default Extensions (Future Consideration)
These extensions are **not enabled by default** in Pandoc and are lower priority for initial implementation.
### Non-Default: Emphasis & Formatting
- â Extension: `mark` - `==highlighted==` text (non-default)
### Non-Default: Links
- â Extension: `autolink_bare_uris` - Bare URLs as links (non-default)
- â Extension: `mmd_link_attributes` - MultiMarkdown link attributes (non-default)
### Non-Default: Math
- â
Extension: `tex_math_single_backslash` - `\( \)` and `\[ \]` (non-default, enabled for RMarkdown)
- â
Extension: `tex_math_double_backslash` - `\\( \\)` and `\\[ \\]` (non-default)
- â Extension: `tex_math_gfm` - GitHub Flavored Markdown math (non-default)
### Non-Default: Metadata
- â Extension: `mmd_title_block` - MultiMarkdown metadata (non-default)
### Non-Default: Headings
- â Extension: `mmd_header_identifiers` - MultiMarkdown style IDs (non-default)
### Non-Default: Lists
- â Extension: `lists_without_preceding_blankline` (non-default)
- â Extension: `four_space_rule` - Four space vs two space list indent (non-default)
### Non-Default: Line Breaks
- â Extension: `hard_line_breaks` - Newline = `<br>` (non-default)
- â Extension: `ignore_line_breaks` - Ignore single newlines (non-default)
- â Extension: `east_asian_line_breaks` - Smart line breaks for CJK (non-default)
### Non-Default: GitHub-specific
- â Extension: `alerts` - GitHub/Quarto alert/callout boxes (non-default)
- â Extension: `emoji` - `:emoji:` syntax (non-default)
- â Extension: `wikilinks_title_after_pipe` - `[[link|title]]` (non-default)
### Non-Default: Quarto-Specific
- â
Quarto executable code cells with output
- â Quarto cross-references `@fig-id`, `@tbl-id`
- â Quarto callout blocks (`.callout-note`, etc.)
### Non-Default: RMarkdown-Specific
- â RMarkdown code chunks with output
- â Bookdown-style references (`\@ref(fig-id)`, etc.`)
### Non-Default: Other
- â Extension: `abbreviations` - Abbreviation definitions (non-default)
- â Extension: `attributes` - Universal attribute syntax (non-default, commonmark only)
- â Extension: `gutenberg` - Project Gutenberg conventions (non-default)
- â Extension: `markdown_attribute` - `markdown="1"` in HTML (non-default)
- â Extension: `old_dashes` - Old-style em/en dash parsing (non-default)
- â Extension: `rebase_relative_paths` - Rebase relative paths (non-default)
- â Extension: `short_subsuperscripts` - MultiMarkdown `x^2` style (non-default)
- â Extension: `sourcepos` - Include source position info (non-default)
- â Extension: `space_in_atx_header` - Allow no space after `#` (non-default)
- â Extension: `spaced_reference_links` - Allow space in `[ref] [def]` (non-default)
---
## Won't Implement
- Format-specific output conventions (e.g., `gutenberg` for plain text output)