On Wed Feb 25, 2026 at 7:53 PM GMT, Andrew Sayers wrote:
Consider a Moin page that contains the following:
Here is a [[BrokenLink|broken link]] to a missing page.
MoinMoin renders that as:
Here is a <a class="nonexistent" href="/BrokenLink">?</a>broken link to a
missing page.
Which pandoc converts to:
Here is a [[BrokenLink|?]]broken link to a missing page.
As you say, this is sub-optimal.
Unfortunately this is a limitation of the Pandoc MediaWiki writer. The
HTML Reader correctly encodes the class into the IR:
λ> runPure $ readHtml def (T.pack "<a class=test href=foo>bar</a>")
Right (Pandoc (Meta {unMeta = fromList []}) [Plain [Link ("",["test"],[]) [Str "bar"]
("foo","")]])
But the MediaWiki Writer doesn't encode it in the output (probably
because there's no obvious way to):
λ>> let i = Pandoc nullMeta [Plain [Link ("",["test"],[]) [Str "bar"]
("foo","")]]
λ> runPure $ writeMediaWiki def i
Right "[[foo|bar]]"
Since the class name survived into the IR, it's available to Pandoc
filters[1]. Writing one of these (there are a few different language
options for that) would be more robust than running regexps over the
final output.
[1] https://pandoc.org/filters.html
--
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Jonathan Dowland
⢿⡄⠘⠷⠚⠋⠀ https://jmtd.net
⠈⠳⣄⠀⠀⠀⠀ Please do not CC me, I am subscribed to the list.