Edit This Page ⓘClicking 'Edit This Page' opens this page on GitHub. You can edit, and save changes, if you are a contributor to the repository. Close the edit page to return to this one.
Mistletoe & the ampersand story
2023-05-10:
This is a test page to verify, and, if needed, validate a fix for Massive Wiki Builder issue number 49: # Ampersand in a wiki link on the Sidebar leads to 404 on website
Let's see if this same issue shows up here on developer-massive-wiki. And it does.
Next steps: 2023-05-11: leaving the mistletoe wikilink cargo cult:
-
in the Obsidian Markdown page a wikilink has these parts contained within double square brackets and separated by a vertical bar (
|
):- name of the wiki page
- optional display text
-
in the Mistletoe rendered HTML:
-
token.target
== the data in an<a>,</a>
tagged item; this corresponds to the optional display text (if any) in the wikilink; otherwise the page name -
self.render_inner(token)
== content of the'href'
attribute in an<a>,<a/>
tagged item; this corresponds to a weblink to the wiki page, relative to the root of the wiki directory (Obsidian vault). This value is read from a wikilinks directory constructed when running Massive Wiki Builder.
-
-
one way to fix this ampersand in the page name problem is to counteract the
html.escape()
use prevalent in themistletoe
render classes when retrieving a weblink from thewikilinks
dictionary.- the key line of code in
mistletoe_renderer/massivewiki.py
is this:
- the key line of code in
wikilink_key = html.unescape(Path(self.render_inner(token)).name)