Skip to content

fix: enable GFM extension for markdown rendering in proxy mode#9465

Open
icebear0828 wants to merge 1 commit intoAlistGo:mainfrom
icebear0828:fix/goldmark-gfm-table
Open

fix: enable GFM extension for markdown rendering in proxy mode#9465
icebear0828 wants to merge 1 commit intoAlistGo:mainfrom
icebear0828:fix/goldmark-gfm-table

Conversation

@icebear0828
Copy link
Copy Markdown

Summary

When filter_readme_scripts is enabled, markdown files served through the proxy (/p/ and /d/) are converted to HTML via goldmark.Convert(). However, the default goldmark converter does not include GFM extensions, so tables, strikethrough, autolinks, and task lists are rendered as plain text instead of proper HTML elements.

For example, a GFM table:

| col1 | col2 |
|------|------|
| a    | b    |

gets wrapped in <p> as plain text instead of generating <table> HTML.

This PR adds extension.GFM to the goldmark converter. No new dependencies are needed — goldmark/extension is part of the github.com/yuin/goldmark package already in go.mod.

Changes

  • server/handles/down.go: Replace goldmark.Convert() with a goldmark instance configured with extension.GFM

Test plan

  • Enable filter_readme_scripts in settings
  • Create a markdown file with a GFM table and view it through the web UI proxy
  • Verify the table renders as an HTML <table> element instead of plain text in <p>
  • Verify strikethrough (~~text~~) also renders correctly

When `filter_readme_scripts` is enabled, markdown files served through
the proxy are converted to HTML using goldmark. However, the default
goldmark converter does not include GFM (GitHub Flavored Markdown)
extensions, causing tables, strikethrough, and other GFM syntax to be
rendered as plain text instead of proper HTML elements.

This adds `extension.GFM` to the goldmark converter so that GFM tables,
strikethrough, autolinks, and task lists are correctly converted to HTML.
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.

1 participant