This is a discussion about which generally useful behavior belongs in Tempest and which should remain a downstream extension. The examples below were checked against upstream main / 1.2.2 with highlighting disabled.
1. Make configured rules work inside nested tokens
prependRules() and removeRules() affect the outer parser, but paragraph, heading, list, link, and table tokens call forToken() with hard-coded rule lists. A custom ^ rule, for example, fires for ^x at document start but not for a ^x, - ^x, or ## ^x. This prevents downstream syntax from being implemented as an ordinary Tempest rule throughout a document.
This overlaps #13 (configurable rules/tokens) and #18 (removeRules() inside nested contexts). The likely requirement is composable rules per context (block versus inline), rather than blindly copying block rules into every inline parser. It would be useful to know your preferred API before attempting a fix.
2. Correct generic link and image parsing
| Input |
Current result |
Expected meaning |
[x](/a "Title") |
href="/a "Title"" |
href="/a" and title="Title" |
[x](a b) |
A link with a space in href |
Literal text; the unbracketed destination is invalid |
[x](<a b>) |
href="<a b>" |
A link to a b, with appropriate URL encoding |
 |
Title folded into src |
Separate image source and title |
The general rule should parse destination, optional title, escapes, entities, and balanced parentheses before rendering. A renderer hook for parsed links/images would let integrations use those services without rewriting serialized <a> and <img> tags.
3. Preserve raw HTML and distinguish literal text from markup
<script>const x = "**a**";</script> currently becomes <script>const x = "<strong>a</strong>";</script>. The script body must remain raw. This is separate from #20, which asks whether raw HTML should be allowed, escaped, or stripped.
Other generic inline cases include a\*b retaining its backslash and a_b_c becoming emphasis. Escaping plain text/entities correctly in text tokens, while keeping raw HTML and code opaque, would nice.
4. Finish structural Markdown before adding CMS syntax
Examples still requiring downstream handling include #titre being parsed as a heading without the required separator; 2. First losing its list start number; ~~~ fences being parsed as strikethrough; and nested/loose lists and hard line breaks. Automatic heading IDs should also be optional or render-configurable.
Several narrower issues/PRs already cover parts of this: #27/#29, #28/#30, #31/#32, #33/#34, and #35/#36. I am listing them here for context. GFM task lists (- [x] Done, currently rendered as an empty-URL link) could be an optional extension.
5. Keep application behavior downstream
A small set of stable rule and rendering hooks in Tempest would make cool thing possible without pre-processing Markdown or post-processing HTML (Example).
@brendt, which of these would you want in the core parser, which as optional rules, and which should be solved through extension hooks? In particular, is the rule-configuration direction in #13/#18 the right prerequisite? I will wait for your feedback before opening any further PRs for the items in this discussion.
This is a discussion about which generally useful behavior belongs in Tempest and which should remain a downstream extension. The examples below were checked against upstream
main/ 1.2.2 with highlighting disabled.1. Make configured rules work inside nested tokens
prependRules()andremoveRules()affect the outer parser, but paragraph, heading, list, link, and table tokens callforToken()with hard-coded rule lists. A custom^rule, for example, fires for^xat document start but not fora ^x,- ^x, or## ^x. This prevents downstream syntax from being implemented as an ordinary Tempest rule throughout a document.This overlaps #13 (configurable rules/tokens) and #18 (
removeRules()inside nested contexts). The likely requirement is composable rules per context (block versus inline), rather than blindly copying block rules into every inline parser. It would be useful to know your preferred API before attempting a fix.2. Correct generic link and image parsing
[x](/a "Title")href="/a "Title""href="/a"andtitle="Title"[x](a b)href[x](<a b>)href="<a b>"a b, with appropriate URL encodingsrcThe general rule should parse destination, optional title, escapes, entities, and balanced parentheses before rendering. A renderer hook for parsed links/images would let integrations use those services without rewriting serialized
<a>and<img>tags.3. Preserve raw HTML and distinguish literal text from markup
<script>const x = "**a**";</script>currently becomes<script>const x = "<strong>a</strong>";</script>. The script body must remain raw. This is separate from #20, which asks whether raw HTML should be allowed, escaped, or stripped.Other generic inline cases include
a\*bretaining its backslash anda_b_cbecoming emphasis. Escaping plain text/entities correctly in text tokens, while keeping raw HTML and code opaque, would nice.4. Finish structural Markdown before adding CMS syntax
Examples still requiring downstream handling include
#titrebeing parsed as a heading without the required separator;2. Firstlosing its list start number;~~~fences being parsed as strikethrough; and nested/loose lists and hard line breaks. Automatic heading IDs should also be optional or render-configurable.Several narrower issues/PRs already cover parts of this: #27/#29, #28/#30, #31/#32, #33/#34, and #35/#36. I am listing them here for context. GFM task lists (
- [x] Done, currently rendered as an empty-URL link) could be an optional extension.5. Keep application behavior downstream
A small set of stable rule and rendering hooks in Tempest would make cool thing possible without pre-processing Markdown or post-processing HTML (Example).
@brendt, which of these would you want in the core parser, which as optional rules, and which should be solved through extension hooks? In particular, is the rule-configuration direction in #13/#18 the right prerequisite? I will wait for your feedback before opening any further PRs for the items in this discussion.