Skip to content

Changelog

  • Keep the formatting of a block that leaves bold or a link (#149)
  • Read file embeds and categories in wikitext (#148)
  • Make relative links and images absolute with a base URL (#148)
  • Keep colspan and rowspan of a table cell (#148)
  • Pass ESC and emoji through in s9e XML and read the alignment BBCodes (#148)
  • Read <CENTER> in s9e XML as a centered block (#148)
  • Read the Litedown elements of s9e XML (#148)
  • Read <del> as a deletion and write it as the HTML tag (#148)
  • Read <ins> and <mark> and write them as the HTML tags (#148)
  • Tell a block spoiler from an inline one (#148)
  • Let the HTML registry say which tags are expected without a handler (#148)
  • Read <HR> in s9e XML as a horizontal rule (#148)
  • Write strikethrough with HTML tags for a tilde behind an empty element (4586bbb)
  • Keep a block inside the quote when its paragraph leaves bold (#149)
  • Go on with open formatting in the next list item and table cell (#149)
  • Drop a link that was opened again and stayed empty (#149)
  • End a table cell with what is still open in it (#148)
  • End a link with the tag it was opened in (#148)
  • End a link with what is still open in it (#148)
  • Move a block out of a mail link, a color and a size (#148)
  • Repair more of the trees the normalizer gets (#148)
  • Leave out spaces that follow a space between elements (#148)
  • Keep long runs of apostrophes and unclosed tags in wikitext fast (#148)
  • Render the cells of a nested table once (#148)
  • End what is open in a block when the block closes (#148)
  • End a [*] without a list when the element around it closes (#148)
  • Do not join lines after a <pre> block for a <nowiki> inside it (#148)
  • Leave a [*] in a quote or a table cell of a list item as text (#148)
  • Highlight more than one search term in the playground examples (#148)
  • Reject a base URL with whitespace in it (#148)
  • Write a block spoiler without the plugin as a plain div in HTML (#148)
  • Keep the space when a block is moved out of two containers (#148)
  • Write a ? in the title of a wiki page as %3F (#148)
  • Keep wikitext with unclosed links or nowiki tags fast (#148)
  • Keep the content of a div on a line of its own (#148)
  • Write a paragraph with an upload as a div in an HTML table (#148)
  • Read the HTML-like tags of wikitext in any case (#148)
  • Read bold inside italic and a nowiki over several lines in wikitext (#148)
  • End an open BBCode tag with its list item (#148)
  • Keep a closing ~~ or BBCode tag out of a URL in front of it (#148)
  • Escape a < that starts an autolink the text does not close (#148)
  • Drop the line break right after a code tag (#148)
  • Write no size for an image that has only a width (#148)
  • Keep the space after a code span that starts a line in s9e XML (#148)
  • Write nothing for an empty paragraph in html_mode (#148)
  • Report a class without a name in the normalizer (#148)
  • Keep a wiki link whose text is the page title a link (#148)
  • Keep the words after a space in an unquoted BBCode option (#148)
  • Keep the text around a hoisted block apart (#148)
  • Write one blank line between two blocks of a blockquote (#148)
  • Do not count thead, tbody and tfoot as unknown HTML tags (#148)
  • Keep an empty [[]] in wikitext as text (#148)

Full Changelog: https://github.com/discourse/markbridge/compare/v0.5.0...v0.5.1


This is the first release where the renderer knows what the target Discourse site can cook. Markbridge.discourse_renderer(features: { ... }) says which plugins the site has (details, spoiler, poll, post_event, bbcode), and with a plugin missing the renderer writes a plain form instead of its BBCode. Colors and sizes need a decision now: the first [color] or [size] raises Markbridge::UndecidedFeatureError until you pass features: { bbcode: false } (text only) or features: { bbcode: true } with a sizes: mapping for discourse-bbcode. Before, they were dropped without a word.

The inline tags (emphasis, links, images, superscript, subscript, colors, sizes, line breaks) return tokens instead of Markdown, and one serializer writes the markers with the neighbors in view. If you wrote custom tags, read the upgrade guide: wrap_inline is gone, and a tag that calls render on a built-in inline tag gets an Array now.

Most of the fixes below were found by new tests, not by reviews: the renderer output is now checked against markdown-it with Discourse’s settings and against Discourse’s own engine, and two fuzzers put every inline node kind next to every other one and build random nested documents. Rendering got faster on the way (Ruby 4 with YJIT, same corpus): 19.7 to 19.5 µs per ASCII post, 36.7 to 34.7 µs per multibyte post, and the escaper takes half the time on mixed text.

  • Ask for a decision on colors and sizes (#135)
  • Say which plugins the target site has (#135)
  • Let a placeholder say what will replace it (#140)
  • Write colors and sizes as BBCode when asked, otherwise as text (#133)
  • Keep two spoilers on one line apart when text stands between them (3d9fdae)
  • Escape a < or a -- that two text pieces make when they meet (#142)
  • Keep a colon right after a color or size tag at the start of a line (#142)
  • Write a file attachment inside a link as its name (#142)
  • Write uploads, polls and events inside an HTML table as Markdown islands (#142)
  • Keep a list apart from a plain details block or poll with the other marker (#142)
  • Escape angle brackets in a link destination with whitespace (#142)
  • Write the destination of an upload like the one of a link (#142)
  • Escape the pipes of an upload inside a table cell (#142)
  • Keep two spoilers on one line apart (#141)
  • Write a spoiler inside a link as its text (#141)
  • Keep the plain form of a details block apart in html_mode (#141)
  • Write the title of a spoiler as text in front of it (#135)
  • Treat a link whose text is the href with whitespace around it as bare (#139)
  • Move a <br> at the edges of a link label out of the link (#138)
  • Keep the text around an empty quote, code block or details apart (#137)
  • Render a quote without author as [quote] around a named quote (#132)
  • Close and reopen emphasis around a blank line (#131)
  • Handle whitespace and ignored text in s9e XML like phpBB shows it (#130)
  • Keep an inline HTML tag off a line of its own (#129)
  • Keep html_mode content inside its HTML block (#128)
  • Write a table with a block in a cell or a late header row as HTML (#127)
  • Keep a mention apart from punctuation too, and drop a <br> that ends a block (#124)
  • Keep a newline after a hard break inside the paragraph (#122)
  • Keep a word and a mention apart (#122)
  • Keep lists tight around nested lists, line breaks and blank lines (#120)
  • Escape the alt text and the filename of an upload (#115)
  • Keep a heading on one line (#115)
  • Escape the inside of an HTML tag and the info string of a fence (#115)
  • Keep the content of a details block apart from its tag lines (#115)
  • Take the href of [url]…[/url] from its text (#111)
  • Write a bare URL as a link when markdown-it keeps the punctuation after it (#111)
  • Link a bare URL with inline code or emphasis next to it (#93)
  • Keep the outer list tight when text follows a nested list (#93)
  • Find siblings and the last list under any parent (#93)
  • Leave a ! in front of a [ alone in html_mode (#93)
  • Count Unicode punctuation at the edge of emphasis (#93)
  • Write strikethrough with a tilde at its edge as an s tag (#93)
  • Keep a heading that is only a run of # as text (#93)
  • Keep the alt text of an image in one piece (#93)
  • Wrap an image destination with whitespace in angle brackets (#93)
  • Keep a bare URL plain when sentence punctuation follows it (#93)
  • Collapse the blank lines that whitespace-only lines leave (#93)
  • Separate two lists that have whitespace between them (#93)
  • Give a context without a parent a root context (#93)
  • Double a backslash in link and image destinations (#93)
  • Use the escaped text as the label of a glued bare URL (#93)
  • Escape a bang after an escaped backslash (#93)
  • Escape parentheses in image destinations (#93)
  • Link a bare URL that is glued to text (#93)
  • Escape an ordered-list marker that stands alone on a line (#93)
  • Keep text after a nested list out of the last nested item (#93)
  • Keep emphasis next to a word working when its content ends in punctuation (#93)
  • Separate two lists of the same kind (#93)
  • Escape a ! that stands directly in front of a link (#93)
  • Write a horizontal rule inside a list item with stars (#93)
  • Keep a run of # at the end of a heading (#93)
  • Escape parentheses in link destinations (#93)
  • Keep the alternative text of images (#93)
  • Pick a safe delimiter for inline code (#93)
  • Leave fenced code blocks alone in the postprocessor (#93)
  • Do not add a blank line after code that ends with a newline (#93)
  • Check edge whitespace and whitespace-only lines by byte (#121)
  • Find a sibling by the position the renderer knows (#93)
  • Drop the escaper’s per-line allocations and shorten the inline loop (#93)
  • Decide a sibling join from a lookup table (#93)
  • Skip the fence scan when there is nothing to clean (#93)
  • Find a fence with string searches instead of a regex (#93)
  • Find fences with string searches and keep the gsub copies out (#93)
  • Take the join rules and the sibling lookup off the hot path (#93)

Full Changelog: https://github.com/discourse/markbridge/compare/v0.4.3...v0.5.0


  • Keep the space at an inline element’s edge in HTML (#95)

Full Changelog: https://github.com/discourse/markbridge/compare/v0.4.2...v0.4.3


  • Render aligned blocks as Markdown islands and indent nested lists relatively (#86)

Full Changelog: https://github.com/discourse/markbridge/compare/v0.4.1...v0.4.2


  • Always escape setext heading underlines (#82)

Full Changelog: https://github.com/discourse/markbridge/compare/v0.4.0...v0.4.1


  • Add a block flag to AST::Code (#72)
  • Match AST subclasses by ancestry in rules and tag dispatch (#72)
  • Add HTML heading parsing and the shared html_mode example (#70)
  • Improve code language detection and drop empty element output (#70)

Full Changelog: https://github.com/discourse/markbridge/compare/v0.3.1...v0.4.0


  • Add an AST normalization pass for target-format nesting rules (#67)

Full Changelog: https://github.com/discourse/markbridge/compare/v0.3.0...v0.3.1


  • Expose the bare-link judgment as AST::Url#bare? (#62)
  • Let tag overrides fall back to the stock rendering (#62)
  • Keep bare and relative URLs intact in UrlTag (#62)
  • Model quote attributions with honest names and types (#62)

BBCode and MediaWiki now convert roughly twice as fast, HTML about 1.5×, with allocations down 3–9.5× depending on the format. Multibyte text no longer carries a penalty — scanning non-ASCII BBCode was up to 5× slower than ASCII and is now at parity.

  • Trim TextFormatter per-parse and per-element overhead (#61)
  • Cut the HTML tree walk’s per-node overhead (#61)
  • Build the MediaWiki inline tag registry only once (#60)
  • Convert the MediaWiki inline parser to byte-offset jump scanning (#60)
  • Skip the line split for single-line text in MarkdownEscaper (#59)
  • Turn RenderContext into a linked parent chain (#59)
  • Cut small allocations in the parse and render hot paths (#58)
  • Convert the BBCode scanner to byte offsets (#58)
  • Build the default handler registry and tag library only once (#58)

Full Changelog: https://github.com/discourse/markbridge/compare/v0.2.1...v0.3.0


  • Removed the Markbridge::Processors::DiscourseMarkdown module — the scanner and the mention/poll/event/upload detectors. This code is moving into the Discourse migrations tooling. (#56)

Full Changelog: https://github.com/discourse/markbridge/compare/v0.2.0...v0.2.1


The migration API was redesigned around structured result types (#30). UPGRADING.md has before/after examples for every change.

  • parse_* methods now return a Parse and *_to_markdown / convert return a Conversion instead of raw Strings — use Conversion#markdown (or #to_s) for the output (#30)
  • Global configuration is gone: Markbridge::Configuration, .configure, .reset_defaults!, and all default_* accessors were removed — build a reusable renderer with Markbridge.discourse_renderer(...) and pass it via renderer: (#30)
  • tags:, tag_library:, escaper:, and escape_hard_line_breaks: were removed from the per-call signatures; *_to_markdown / convert accept only handlers:, renderer:, and raise_on_error: (#30)
  • Proc/lambda handlers are no longer supported — handlers must be objects responding to #process(...) (#30)
  • MediaWiki parser kwarg renamed: inline_tag_registry: → handlers: (#30)
  • TextFormatter handlers must accept a processor: keyword (#30)
  • Markbridge.discourse_renderer(...) factory builds reusable Renderer instances — accepts tags:, tag_library:, unregister:, escaper:, escape:, escape_hard_line_breaks:, allow:, postprocessor:, strip_trailing_invisibles: (#30)
  • Markbridge.convert(format:) dispatcher and polymorphic Markbridge.render(Parse | AST::Node) (#30)
  • AST mutation between parse and render: block form on every *_to_markdown / convert, plus AST::Element#each_descendant, #descendants(klass = nil), and #replace_child(old, new) (#30)
  • raise_on_error: false collects render errors on Conversion#errors for per-row failure isolation in batch migrations (#30)
  • Selective Markdown escaping via MarkdownEscaper#allow: (:bullet_list, :ordered_list, :atx_heading, :block_quote, alias :lists), and IdentityEscaper / discourse_renderer(escape: false) for already-trusted Markdown (#30)
  • Handler registries gain #overlay(name) { |previous| ... } for wrapping default handlers (BBCode, HTML, TextFormatter) (#30)
  • TagLibrary#unregister — unregistered AST classes auto-pass-through to their rendered children (#30)
  • HTML and TextFormatter parsers accept pre-parsed Nokogiri input (DocumentFragment, Document, Element) in addition to Strings (#30)
  • AST::Details + DetailsTag for Discourse [details=…]…[/details] collapsible sections (#30)
  • Optional strip_trailing_invisibles config flag (#39)
  • Collapse whitespace in HTML per spec (#36)
  • Map inline span styles to AST formatting nodes (#34)
  • Make RenderContext parent-queries answer is_a? semantics (#42)
  • Move ] label-escape into MarkdownEscaper so image-in-link works (#41)
  • Escape ] in link labels to prevent early link termination (#40)
  • Insert blank line between raw text and following block elements (#37)
  • Skip [u] wrapper inside [url] and [email] (#36)
  • Skip [u] wrapper when underline content is whitespace-only (#35)
  • Treat Unicode whitespace as whitespace in RenderingInterface#wrap_inline (#33)

Full Changelog: https://github.com/discourse/markbridge/compare/v0.1.3...v0.2.0


  • Treat \r as part of CRLF terminator in MarkdownEscaper (#32)

Full Changelog: https://github.com/discourse/markbridge/compare/v0.1.2...v0.1.3


  • Make BBCode HandlerRegistry and Discourse TagLibrary enumerable (#28)
  • Name receiver class in AST::Element#<< type error (#28)
  • Copy text into a fresh buffer in AST::Text (#28)
  • Render Markdown as HTML inside the table fallback (html_mode) (#26)

Full Changelog: https://github.com/discourse/markbridge/compare/v0.1.1...v0.1.2


  • Add Markdown table support with HTML fallback (#13)
  • Drop raw-text and metadata HTML elements entirely (#16)
  • Emit trailing blank line after quotes (#21)
  • Emit trailing blank line after more block-level tags (#22)

Full Changelog: https://github.com/discourse/markbridge/compare/v0.1.0...v0.1.1


Full Changelog: https://github.com/discourse/markbridge/commits/v0.1.0