Open cscheid opened 4 weeks ago
Quarto really ought to do this automatically ahead of Pandoc.
But I really do feel that this is a Pandoc "bug" in that its smart ASCII-to-unicode processing is way too eager in the presence of URLs.
In Quarto 1.5, we have a (n admittedly fairly gross) syntax for "escaping" arbitrary Pandoc content through its Markdown representation. Consider this:
```` --- format: html value: xn--oh.no value2: '`Str "xn--oh.no"`{=pandoc-native}' --- {{< meta value >}} {{< meta value2 >}} ```` |
|
Notably, my workaround is format-agnostic (because it produces an actual pandoc.Str
entry in the metadata object). In contrast, @mcanouil's suggestion in #10021 only works for specific formats.
@machow If you need 1.5 to ship pristine URLs across metadata, and you know that they're URLs, you can use that syntax.
We should have a transparent mechanism for this, but the {=pandoc-native}
trick should get you going.
Re-posting below for context the explanation regarding why Pandoc does convert to en-dash.
This is all due to Pandoc Markdown reader when +smart
extension is set, which is the default for from: markdown
So we could also opt-out this extension in our qmd reader (from: markdown-smart
) and this won't ever happen.
Though it would have other impact on content output (especially for TeX ligatures in LaTeX pdf output)
From https://github.com/quarto-dev/quarto-cli/issues/10021#issuecomment-2175680126
With smart extension | without smart extensions |
````powershell
❯ quarto pandoc --from markdown --to html
pr--450
pr-450
^Z
pr–450 pr-450 ```` |
````powershell
❯ quarto pandoc --from markdown-smart --to html
pr--450
pr-450
^Z
pr--450 pr-450 ```` |
With smart extension | without smart extensions |
````powershell ❯ quarto pandoc --from markdown --to native pr--450 ^Z [ Para [ Str "pr\8211\&450" ] ] ```` | ````powershell ❯ quarto pandoc --from markdown-smart --to native pr--450 ^Z [ Para [ Str "pr--450" ] ] ```` |
Related issue in the past where internally using the new pandoc-native
raw block feature from pandoc was the way
If pandoc-native
is the way, then I think the following part (and subsequent parts) of the codebase for href
might need refactoring:
This happens in metadata, but it's likely that it also happens in other parts.
Repro:
(This is, ultimately, the same bug that caused us to have to reimplement shortcodes:
{{< foo https://pr-350--quartodoc.netlify.app >}}
would destroy the URL in the past.)