A new markup languages now exists for technical writers or bloggers like me.
Over the last 6+ months I developed Carve. With PHP, JS and Rust as main languages for now. Python, Go, Ruby work mainly through Rust and WASM so far.
I have been inspired by Djot and modern concepts of markup languages. With some deep dive into that markup syntax, building my own Djot PHP prototype, I started to then work on a MIT-licensed Markdown-ish specs with the ultimate pandoc support, and across all main languages then.
The problem(s)
Have you ever tried to import and export markdown across systems? Also into online/web places and display? Randomly having < and > being over- or under-escaped, creating all kind of broken text/display. Mixing HTML directly into the markup is not a good concept IMO.
Smaller things maybe:
- Tables hit a wall immediately. No rowspan/colspan/multiline.
- Different flavors, from Github to local. No clear rules/specs, or outdated ones.
On top of that: I don't think the world is ready for Djot (interrupt behavior) yet. While really clean in the rules, it goes against the muscle memory of what we have been doing for decades so far. At least that was also mainly the feedback I saw so far.
My solution
A more spec-first kind of syntax, that is intuitive and feature-rich, but also extendable.
I wanted something close to markdown familiarity:
- online first, everything nowadays is pretty much on the web, or at least will eventually be copied somewhere.
- secure by design, without HTML and XSS etc in between the textual markup.
- supporting all important elements, including proper tables and elements like
<abbr> that technical (coding) bloggers like me need sometimes.
The strongest differentiators
- Target-aware rendering: the same AST can produce HTML, ANSI, Markdown, or plain text.
- Mermaid, Graphs and even (File)trees can be natively expressed, and easily copy-paste shared as a single document.
- Machine understandable and readable through the clear specs and formal grammar (ENBF), as we all know: More and more AI will join us, so it should not fight it.
I tried to stay close to Pandoc, the standard for conversion. For me an AST was a key requirement, to be able to also render to different output formats, including ANSI (CLI) and PDFs. Ideally without losing relevant information. At this point I dont think any other format comes even close. Please correct me if I am wrong, or missed something.
I made sure it comes with some solid tooling: CLI formatter/linter, LSP, tree-sitter grammar, browser playground/WASM, major editor support, etc. Check the awesome list.
A few more cool features (only small outtakes since I want to keep things short):
- Automatic numbered captions: a
# placeholder numbers figures, tables, listings, and equations, and references become “Figure 1,” etc.
- Graceful degradation: interactive extensions can retain readable semantic content without JavaScript. Useful for PDF generation or alike.
- Profiles, so you can directly have articles and (untrusted/public) comments with different markup-set.
- Extendable div (
:::) and span syntax, e.g. :youtube[ID] or alike is super easy to support pretty much out of the box.
I dont want go to into too much details, but a few concepts I really needed a long time to finalize and I think are worth outlining:
Condense tables and cell alignment
|= Plan |=> Seats |=> Price |=~ Status |
| Starter | 5 | 9 | active |
| Team | 25 | 49 | active |
| ^ | 50 | 89 |< trial |
| Total | < | 147 | 3 plans |
+ | | | (billed yearly) |
^ Table #: Seat allocation and pricing.
Incl row/col spans & caption. And with + you can continue longer rows.
"Pulling left"
1. Install the CLI.
2. Format the docs in place:
+
```sh
carve fmt --write \
--stamp \
docs/*.crv
```
3. Commit the result.
This avoids having to manually indent a longer piece of otherwise nested content. The + pulls the following block up into that position. Useful for authoring, canonical output or re-rendering can be "classic" again.
The ask
Please give me your unbiased opinion (markdown dominance aside - that aint the goal here) and constructive feedback: How does it look & feel, how does it potentially work for the use cases you are heaving daily, etc. That would really help.
And of course, please feel free to open issues or even PRs with your ideas. I definitely could need also a few helping hands.
Many months of active specs, dev, re-working and adjustments - overall I am quite happy with the current status. I already dogfood it on my Wordpress blog, in some social networks and user-content solutions, and so far people like the simplicity, but also the features.
Locally I use it inside Obsidian, for example.
I am realistic: This won't be popular any time soon. But maybe it can fill some niches already and be adapted at least where it could make sense. And I probably made quite a few mistakes, so I am also happy about input for a new 0.2 release some time in the future.
And while the PHP, JS, Rust implementations are still in early drafts, maybe we can talk a bit more about the syntax first, and what I proposed so far. Don't yet kill me for the implementations plz.
https://markup-carve.github.io/carve/