Skip to content

Add --disable-markdown-feature to selectively disable optional markdown features#73

Open
falloutphil wants to merge 1 commit into
chrishrb:mainfrom
falloutphil:main
Open

Add --disable-markdown-feature to selectively disable optional markdown features#73
falloutphil wants to merge 1 commit into
chrishrb:mainfrom
falloutphil:main

Conversation

@falloutphil
Copy link
Copy Markdown

Hi,

I finally got around to submitting a candidate for feature request: #63

I've made it more generic so allows disabling of any combination of markdown plugins, which is more useful than writing a targetted feature just for mathjax.

Details below.

Summary

This adds a --disable-markdown-feature flag so optional markdown features can be turned off selectively.

Supported feature names:

  • details
  • footnote
  • ghissue
  • mathjax
  • mermaid

The original issue was about disabling MathJax so LaTeX can pass through unchanged, but the implementation is generalized so the same mechanism can be reused for other optional markdown features as well.

Implementation

  • add a central registry of optional markdown features in internal/parser.go
  • validate feature names from the CLI before starting the server
  • build the Goldmark extension list dynamically from the enabled features
  • pass the same feature state into the HTML template so feature-specific assets are omitted when a feature is disabled

Tests

  • add table-driven parser tests covering disable behavior for mathjax, mermaid, details, footnote, and ghissue
  • add table-driven server/template tests verifying feature-specific assets are omitted for mathjax and mermaid
  • run go test ./...

Notes

  • the README usage section was updated to document the new flag
  • while touching that section, two stale examples using flags that no longer exist (-r and -d) were removed so the documented commands match the current CLI

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