Introduction
Markbridge is a Ruby library that converts BBCode, HTML, MediaWiki wikitext, and s9e/TextFormatter XML into Discourse-flavored Markdown. You can convert individual documents or process a large collection. You can also inspect the parsed content and customize the output.
- Parse — a format-specific parser reads your input and builds an
AST::Document. You can review unknown tags in the result. - AST — a renderer-agnostic tree. The same shape comes out no matter which format went in.
- Render — the Discourse renderer walks the tree and emits Markdown.
The parse and AST stages know nothing about Discourse — “Discourse-flavored” is just what the shipped renderer produces. You could point a different renderer at the same AST.
Four input formats, one renderer
Section titled “Four input formats, one renderer”Markbridge ships four parsers that all feed the same Discourse renderer: BBCode, HTML, MediaWiki, and s9e/TextFormatter XML. Pick the one that matches your source — Getting Started shows the exact method for each.
When to use it
Section titled “When to use it”Use Markbridge when you need to convert existing markup to Markdown, inspect structured content, or adapt output to your application.
Forum migration to Discourse is the main use case. You can track unknown tags, handle conversion errors per post, and use custom AST nodes for references to uploads, users, and topics. The migration guide explains that workflow.
Find your way around
Section titled “Find your way around”- Getting Started — install and run your first conversion.
- Format guides — exactly how each input maps to Markdown.
- Customization — build a reusable renderer, and add your own tags and handlers.
- Concepts — the architecture, the AST, the parsers and renderer, and performance.
- Migrating to Discourse — the full forum-migration workflow.