Markdown widget for fof/forum-widgets-core
composer require linkrobins/markdown-widget
Then enable it in your forum's admin panel under Extensions.
A simple Markdown widget for Flarum 2.0, built as a widget for fof/forum-widgets-core. Same skeleton as linkrobins/html-widget, with a Markdown renderer in front of the body.
Adds one configurable Markdown widget to the FoF Forum Widgets placement editor. Admin sets:
fab fa-markdown)Drag and place it from the FoF Forum Widgets admin page like any other widget.
Configured in Admin → Extensions → Link Robins Markdown Widget, then placed from the FoF Forum Widgets page.
| Setting | Required | What it does |
|---|---|---|
| Title | no | Shown above the body. Leave blank for a widget with no header. |
| Icon class | no | A FontAwesome class rendered beside the title, e.g. fab fa-markdown. Leave blank for no icon. |
| Markdown body | yes | GitHub-flavored Markdown. Inline HTML is allowed but sanitised. |
| Background color | no | The widget's background. Leave blank to follow your theme, which is what keeps it looking native in both light and dark mode. |
The body is not baked into the forum's boot payload. It is fetched from its own endpoint on demand, and only a short hash of the current settings rides along in the payload.
That hash is what makes an edit show up: changing any setting changes the hash, which changes the fetch URL, so a normal page reload picks up the new content. Readers do not need a hard refresh, and unchanged content still caches normally rather than being re-fetched on every page view.
linkrobins/html-widget instead.fof/forum-widgets-core installed and enabledThe Markdown renderer (marked) and the HTML sanitiser (DOMPurify) are bundled into the extension — nothing is fetched from a CDN at runtime.
Supports the full Markdown syntax that marked.js handles, including:
# H1, ## H2, ...)**bold**) and italic (*italic*)The widget styles headings, lists, code, blockquotes, and tables to fit cleanly in any placement.
The rendered HTML is passed through DOMPurify before display, so <script> tags, event-handler attributes, and other unsafe markup in the Markdown body are stripped. The body is still admin-only — treat it like any other admin-controlled content.