f00b0780b8
Writer-based `Renderer` trait per SPEC §6.8: object-safe
`fn render(&self, doc, w: &mut dyn Write) -> io::Result<()>` plus
a `render_to_string` convenience. Object safety preserves the option
of `Box<dyn Renderer>` in the LSP layer.
`HtmlRenderer` builder accepts a link-resolution callback (via
`with_link_resolver`) and an optional enclosing template (via
`with_template`). The default resolver mirrors §9: Wiki paths become
`path.html`, interwiki links land in sibling directories
(`../wiki<N>/` / `../wn-<Name>/`), diary entries under `diary/`,
file/local schemes use literal paths, anchor-only collapses to `#`.
Renderer covers every AST node:
- block: heading (centered class), paragraph, hr, blockquote,
preformatted (`language-<lang>` class), math block (with
`\begin{env}` when an environment is set), lists (ordered/unordered
+ every checkbox state, plus recursive sublists), definition list
(dt/dd), table (thead/tbody driven by `is_header`, col/row span as
CSS class hooks), comment (as HTML comment with `--` neutralised),
error node (as `.parse-error` span)
- inline: strong/em + bold-italic, `<del>`, code (escaped),
`<sup>`/`<sub>`, math-inline wrapped in `\(...\)`, keyword spans
with per-keyword class, color spans, wikilink/external/raw URL
anchors, transclusion as `<img>` with sorted attrs
HTML escaping is byte-level (`<>&"'`). Template substitution replaces
`{{content}}` first so a body containing the literal `{{title}}`
isn't double-substituted.
Tests (31 new) cover every block + inline construct, every LinkKind
through the default resolver, HTML escaping, custom resolver
override, template with/without title metadata, and an end-to-end
smoke test on a multi-construct document.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
66 lines
2.0 KiB
Markdown
66 lines
2.0 KiB
Markdown
# nuwiki
|
|
|
|
A Vim/Neovim plugin providing full vimwiki syntax support, implemented as a
|
|
Rust-based language server (LSP).
|
|
|
|
> **Status:** Phase 5 (HTML renderer) complete. End-to-end source → AST → HTML
|
|
> works via `VimwikiSyntax` + `HtmlRenderer`. LSP and editor glue still pending.
|
|
|
|
See [`SPEC.md`](./SPEC.md) for the full project specification.
|
|
|
|
## Implementation status
|
|
|
|
| Phase | Name | Status |
|
|
|---|---|---|
|
|
| 0 | Scaffolding | ✅ done |
|
|
| 1 | Core AST | ✅ done |
|
|
| 2 | Syntax Plugin Interface | ✅ done |
|
|
| 3 | Vimwiki Lexer | ✅ done |
|
|
| 4 | Vimwiki Parser | ✅ done |
|
|
| 5 | Renderer | ✅ done |
|
|
| 6 | LSP Foundation | ⏳ next |
|
|
| 7 | Semantic Tokens | ⏳ |
|
|
| 8 | Navigation | ⏳ |
|
|
| 9 | Editor Glue | ⏳ |
|
|
| 10 | CI/CD release pipeline | ⏳ |
|
|
|
|
## Repository layout
|
|
|
|
```
|
|
nuwiki/
|
|
├── Cargo.toml workspace root
|
|
├── crates/
|
|
│ ├── nuwiki-core/ parser, AST, renderer (no editor deps)
|
|
│ ├── nuwiki-lsp/ LSP protocol bridge
|
|
│ └── nuwiki-ls/ binary that speaks LSP over stdio
|
|
├── plugin/ universal Vim/Neovim entry point
|
|
├── lua/nuwiki/ Neovim Lua glue
|
|
├── autoload/nuwiki/ Vim VimL glue
|
|
├── ftdetect/ filetype detection for .wiki
|
|
├── ftplugin/ per-buffer filetype settings
|
|
├── syntax/ static fallback highlighting
|
|
├── doc/ `:h nuwiki`
|
|
├── scripts/ build-time helpers
|
|
└── .gitea/workflows/ CI / release pipelines
|
|
```
|
|
|
|
## Building
|
|
|
|
```sh
|
|
cargo build --workspace
|
|
cargo test --workspace
|
|
```
|
|
|
|
MSRV: Rust 1.83.
|
|
|
|
## License
|
|
|
|
Dual-licensed under either of:
|
|
|
|
- Apache License, Version 2.0 ([`LICENSE-APACHE`](./LICENSE-APACHE))
|
|
- MIT license ([`LICENSE-MIT`](./LICENSE-MIT))
|
|
|
|
at your option. Unless you explicitly state otherwise, any contribution
|
|
intentionally submitted for inclusion in this work shall be dual licensed as
|
|
above, without any additional terms or conditions.
|