forked from mimoo/cargo-specification
-
Notifications
You must be signed in to change notification settings - Fork 0
Add agnostic spec-level admonition syntax (spec:warning) #5
Copy link
Copy link
Open
Description
Summary
Currently, the markdown flavor feature (#4) transforms between third-party documentation platform syntaxes (mdBook's ```admonish warning ↔ Docusaurus's :::warning). This ties the spec language to specific platforms.
Proposal
Add an agnostic admonition syntax to the spec language itself, similar to the existing spec:startcode / spec:endcode directives:
//~ spec:warning
//~ Be careful with this implementation.
//~ spec:endwarningOr in templates:
spec:warning
Be careful with this implementation.
spec:endwarningSupported admonition types
spec:warning/spec:endwarningspec:info/spec:endinfospec:note/spec:endnotespec:tip/spec:endtipspec:danger/spec:enddanger
Output transformation
The agnostic syntax would then be transformed based on the output flavor:
| Spec syntax | mdBook output | Docusaurus output |
|---|---|---|
spec:warning |
```admonish warning |
:::warning |
spec:endwarning |
``` |
::: |
Benefits
- Platform agnostic: Spec authors don't need to know the target platform
- Consistent with existing syntax: Follows the
spec:prefix convention - Future-proof: Easy to add new output formats without changing specs
- Single source of truth: One syntax that works everywhere
Related
- PR Add Docusaurus markdown flavor support #4: Add Docusaurus markdown flavor support
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels