Skip to content

fix: skip inline markdown-pipeline entries - #58

Merged
mcanouil merged 7 commits into
mainfrom
fix/skip-markdown-envelope-spans-nz8b
Aug 28, 2026
Merged

fix: skip inline markdown-pipeline entries#58
mcanouil merged 7 commits into
mainfrom
fix/skip-markdown-envelope-spans-nz8b

Conversation

@mcanouil

Copy link
Copy Markdown
Owner

A navbar item whose href is a bare platform user URL lost its target. Quarto registers every navigation href as an inline markdown snippet so that shortcodes work there, renders it in a hidden envelope span, then reads the fragment back with innerText and assigns the result to the attribute. The filter converted the URL into a link with a platform badge, and the link text and the badge text concatenated into the href.

The three passes that create links now run top-down and skip the content of a Span with the quarto-markdown-envelope-contents class. Top-down traversal is what makes the skip possible, and the Str pass also stops traversal of its own result, so a created link no longer has its text converted a second time. A Div with the same class is a block entry, such as the page footer or the margin content, which Quarto inserts with innerHTML; those keep converting.

This costs something. The same inline envelope carries values that Quarto inserts with innerHTML: a navbar or sidebar title, a navigation entry text, an about link text, and a next or previous page title. A reference in those no longer becomes a link. The two kinds cannot be told apart, because a navigation entry registers its text and its href under one identifier prefix.

test/navbar-site is a new fixture with check.sh, which renders the site and asserts each expectation. It passes here and reports six failures against the filter as it stands on main. The rendered output of test/sidebar-site, test/widget-site, and docs is unchanged apart from attribute order inside the badge span, which is Lua table order.

Quarto renders a navigation href, an `about` link, and a page `<meta>`
value as a hidden inline snippet, then reads the rendered fragment back
with `innerText` and puts the result in an attribute. A converted
reference added its platform badge text to that value, so a navbar item
whose href was a bare platform user URL lost its target.

The three passes that create links now run top-down and skip the content
of a `Span` with the `quarto-markdown-envelope-contents` class. Block
entries keep their behaviour, because Quarto inserts those with
`innerHTML` and references inside them are wanted.
Also cover the `about` links and the social metadata in the navbar test
site, and narrow the changelog entry: Pandoc builds `<meta
name="description">` from the document metadata rather than from an
inline snippet, so that tag is a separate case.
A navigation entry registers its text and its href under one identifier
prefix, so a reference in a navbar or sidebar title, in a navigation
entry text, or in a next or previous page title no longer converts.
The script renders the site and asserts each expectation, so a change in
the envelope class or in the traversal fails loud. It reports six
failures against the version before the fix.

Also drop the claim about an `about` link target. Quarto registers that
target under one key and reads it back under another, so it never
substitutes the value and the defect never reached it.
`grep -c` counts matching lines, so two references on one line read as
one. Also shorten the changelog entry to two sentences.
@mcanouil mcanouil added the Type: Bug 🐛 Issues related to bugs, errors, or mistakes label Aug 28, 2026
@mcanouil mcanouil self-assigned this Aug 28, 2026
@mcanouil
mcanouil marked this pull request as ready for review August 28, 2026 18:34
@mcanouil
mcanouil force-pushed the fix/skip-markdown-envelope-spans-nz8b branch from 76264ea to 1a806d8 Compare August 28, 2026 18:42
@mcanouil
mcanouil merged commit 9c27f9f into main Aug 28, 2026
@mcanouil
mcanouil deleted the fix/skip-markdown-envelope-spans-nz8b branch August 28, 2026 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Bug 🐛 Issues related to bugs, errors, or mistakes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant