Skip to content

Render Markdown as complete documents, with GFM extensions - #2

Open
sampokuokkanen wants to merge 3 commits into
socketry:mainfrom
sampokuokkanen:markdown-extensions
Open

Render Markdown as complete documents, with GFM extensions#2
sampokuokkanen wants to merge 3 commits into
socketry:mainfrom
sampokuokkanen:markdown-extensions

Conversation

@sampokuokkanen

@sampokuokkanen sampokuokkanen commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Two related changes to how Markdown is rendered.

Enable GitHub Flavored Markdown extensions

Markly.render_html enables no extensions by default, so tables were rendered as literal text, ~~strikethrough~~ was left as-is, bare URLs were not linked, and task lists showed [ ]. Enable the standard set, as most Markdown intended for preview is GitHub Flavored.

Render complete documents

The Markdown renderer returned a bare fragment, with no doctype, charset or title, and thus nowhere to attach a stylesheet — a table rendered without any borders. The directory listing built a document of its own, so the two disagreed about the structure.

Both now share Luna::Document, and Luna's own assets are served from public/ by a second Static middleware at the end of the stack. Because it is last, files in the root take precedence: dropping _static/luna.css into the directory you are serving overrides the bundled stylesheet, without any additional option.

@socketry/syntax is bundled to highlight code, following the same layout as utopia-project:

public/_static/       # luna.css, application.js
public/_components/   # @socketry/syntax

It highlights <code class="language-*">, which is what cmark-gfm already emits, so no adapter is needed. Disable it with --no-syntax-highlighting.

It is declared in package.json and installed with the same task as utopia-project, so upgrading is:

npm update && bake utopia:components:update

Notes

  • Most of the diff is the bundled @socketry/syntax; the Ruby side is ~180 lines across 9 files, which git diff --stat main -- lib test luna.gemspec shows on its own.
  • spec.files now includes public/**/*, and utopia is added to the maintenance group for the components task.

@sampokuokkanen sampokuokkanen changed the title Enable GitHub Flavored Markdown extensions. Render Markdown as complete documents, with GFM extensions Aug 20, 2026
@ioquatix
ioquatix force-pushed the markdown-extensions branch from 8e1d613 to a0d343f Compare August 20, 2026 12:04
@ioquatix

Copy link
Copy Markdown
Member

I've fixed tests on main - do you think you can fix this PR?

`Markly.render_html` enables no extensions by default, so tables were
rendered as literal text, `~~strikethrough~~` was left as-is, bare URLs
were not linked, and task lists showed `[ ]`.

Enable the standard set, as most Markdown intended for preview is
GitHub Flavored.
The Markdown renderer returned a bare fragment, with no doctype, charset
or title, and thus nowhere to attach a stylesheet. The directory listing
built a document of its own, so the two disagreed.

Introduce `Luna::Document`, which both now share, and serve Luna's own
assets from `public/` as the last middleware in the stack, so that files
in the root take precedence and can override them.

Bundle `@socketry/syntax` to highlight code, which can be disabled with
`--no-syntax-highlighting`.
The bundled copy of `@socketry/syntax` was installed by hand, with no
record of which version it came from. Declare it in `package.json` and
install it using the same task as `utopia-project`, so that upgrading is
`npm update && bake utopia:components:update`.

The task reproduces the committed files exactly.
@sampokuokkanen

Copy link
Copy Markdown
Contributor Author

@ioquatix
Thanks, tests now passing.

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.

2 participants