Skip to content

Add LaTeX, super/subscript, pull quotes, callouts, and Markdown docs#65

Open
MattFisher wants to merge 5 commits into
ma2za:mainfrom
MattFisher:markdown-latex-and-others
Open

Add LaTeX, super/subscript, pull quotes, callouts, and Markdown docs#65
MattFisher wants to merge 5 commits into
ma2za:mainfrom
MattFisher:markdown-latex-and-others

Conversation

@MattFisher

@MattFisher MattFisher commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Builds on the from_markdown work from #61, adding several Markdown constructs that map to Substack nodes, plus a documentation page. Node shapes were confirmed by round-tripping editor-authored drafts through the live API.

Closes #63

New Markdown features

  • LaTeX math — inline $…$ (→ latex node) and block $$…$$ (→ latex_block), via mdit_py_plugins.dollarmath.
  • Superscript (^x^) and subscript (~x~) inline marks. Subscript's single-tilde syntax coexists with ~~strikethrough~~.
  • Pull quotes and callouts via fenced-container syntax (:::pullquote / :::callout), since they have no native Markdown equivalent.

Tables: intentionally not supported

An earlier iteration added a table node, but Substack has no table renderer or editor UI — the node stored but never displayed. It's been removed to avoid producing silently-broken drafts. docs/markdown.md documents this and points users at Datawrapper embeds for tabular data.

Docs

New docs/markdown.md documents every supported construct with examples, plus what's intentionally unsupported. Linked from the README's Markdown section.

Dependencies

The sub/superscript plugins require mdit-py-plugins >= 0.5; the constraint (>=0.5,<0.7) and lockfile are updated accordingly (resolves 0.6.1).

Testing

  • Unit tests cover each new construct in test_from_markdown_features.py.
  • The end-to-end fixture and golden file were regenerated from a live round-trip, so every feature here is verified against the real Substack API (RUN_SUBSTACK_E2E=1).

MattFisher and others added 5 commits July 10, 2026 13:16
GFM tables (`| col | col |`) map to Substack's table/table_row/
table_header/table_cell schema. Table node shape was confirmed by
probing the live API.

LaTeX math blocks ($$...$$) map to latex_block via mdit_py_plugins'
dollarmath plugin. Both features are covered by unit tests and the
e2e fixture/golden file.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Inline math ($x$ and $$x$$ via dollarmath's double_inline) now maps to
Substack's inline `latex` node, confirmed against the live API. Previously
inline math tokens were silently dropped.

Also restores the [^unused] and [^listnote] footnote definitions in the
e2e fixture, which had been corrupted, dropping footnote ma2za#4 from coverage.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Drop dollarmath's double_inline option so $$...$$ is only ever a display
block, matching the common Markdown convention. Inline math stays $...$.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Substack has no table renderer or insert UI, so the table node (added
earlier) stored but never displayed. Removed it in favor of features
Substack actually supports, confirmed by round-tripping editor-authored
nodes through the live API:

- pullquote and calloutBlock via `:::pullquote` / `:::callout` containers
- superscript (`^x^`) and subscript (`~x~`) inline marks

Subscript's single-tilde syntax coexists with `~~strikethrough~~`.

The sub/superscript plugins require mdit-py-plugins >= 0.5, so the
constraint and lockfile are updated (now resolves 0.6.1).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add docs/markdown.md covering every Markdown construct from_markdown()
converts (formatting, headings, lists, images, footnotes, math, pull
quotes, callouts) plus what is intentionally unsupported (tables,
editor-only widgets). Link it from the README.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support tables and LaTeX in markdown

1 participant