Repository navigation
feat: table alignment, markdown extensions, frontmatter box, --line-range, math rendering - #25
Merged
Merged
Conversation
Header and body cells are padded left, centred or right per the table's :--, :-: and --: markers, line by line for wrapped cells, measured in display columns so CJK and emoji cells stay aligned.
…allout titles - ^sup^ and ~sub~ render with Unicode super/subscript characters when every character has one, else ^(x) / _(x) (always in ASCII mode). ~~strikethrough~~ is unchanged; a single-tilde pair is now subscript. - ||spoiler|| keeps its bars visible and draws the text in its own background colour until selected or copied. - Definition lists: bold term, definitions indented under a marker. - Alerts and Obsidian callouts show their custom title (> [!NOTE] Title, > [!info]- Title); Obsidian types map onto the five alert colours and fold markers are ignored. - Table cells convert super/subscripts too. underline stays off: comrak's extension turns __bold__ into underline.
--frontmatter (or frontmatter = true) used to feed the metadata to the
markdown parser, which drew a rule and a setext heading made of the
keys. The block is now drawn as a bordered key/value box titled
"frontmatter": top-level keys, scalars unquoted, lists comma-joined,
nested values raw. YAML (---), TOML (+++) and JSON ({ at byte 0)
frontmatter are recognised; JSON is now also stripped by default.
Unterminated or keyless blocks still render as markdown.
bat-style ranges (START:END, START:, :END, N; repeatable; 1-based, inclusive) select lines of the markdown source before it is rendered. A range that cuts a fenced code block reopens the fence with its info string and closes it, so the block stays well-formed and highlighted; disjoint runs are kept apart by a blank line. Invalid ranges are a usage error (exit 2). The reader has no start-at-line hook, so --line-range implies --plain.
Inline $…$, display $$…$$ and ```math blocks (math_code is now on) go through a dependency-free LaTeX-to-Unicode approximation instead of showing raw LaTeX: Greek letters, operators, relations, arrows and big operators; \mathbb/\mathcal/\mathfrak letters; Unicode super- and subscripts with ^(…)/_(…) fallbacks; \frac as a/b with parentheses around compound sides; \sqrt and \sqrt[n]; \text and \mathrm as plain text; matrix, pmatrix, bmatrix, Bmatrix, vmatrix, array, cases, aligned and gathered laid out in rows with padded columns and bracket glyphs. Unknown commands are kept verbatim, nesting is capped, malformed input never panics. Display math sits on its own indented lines; inline math keeps the code colour; table cells render math too. ASCII mode shows the LaTeX source with \left/\right and spacing commands removed. A ```math block's copy hint still yields its LaTeX source.
… scripts comrak's subscript extension turned GitHub's ~struck~ into subscript. It is off again, so ~x~ and ~~x~~ both strike through as in v0.9.0; ^sup^ stays. Inline and block HTML <sub>/<sup> now use the same Unicode script mapping, with the _(x) / ^(x) fallback (always in ASCII mode).
Merged
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
:--,--:and:-:are honoured, including wrapped and CJK cells.^x^, spoilers||x||, definition lists, and callouts with custom titles (> [!NOTE] Title, plus Obsidian types).<sub>and<sup>render as Unicode sub/superscripts.--frontmatter, YAML, TOML and JSON frontmatter render as a key/value box instead of being parsed as markdown. JSON frontmatter is now recognised and stripped by default.--line-rangefor the pager path,bat-style, keeping code fences well-formed when a range cuts through one. Implies--plain.$…$,$$…$$and```mathrender as Unicode: Greek letters, operators, fractions, roots, sub/superscripts, matrices andcases. Prose like "$5 and $10" is left alone. ASCII mode shows cleaned LaTeX.Behaviour changes
:becomes a definition list.```mathblocks render as math instead of a code box.Single-tilde
~x~stays strikethrough, as on GitHub. Underline and highlight are not enabled.Testing
New
tests/rendering_features.rs(through the real pipeline), unit tests for math, frontmatter and line ranges, security tests for the new text paths, and an extended ASCII fixture. No existing snapshot changed. fmt, clippy and the full suite pass locally.🤖 Generated with Claude Code
https://claude.ai/code/session_01UVcvmQrSXd2eyt32g4ko19