quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.76k stars 308 forks source link

Confusing `link-external-filter` example #10780

Open soxofaan opened 5 days ago

soxofaan commented 5 days ago

What would you like to do?

Report an issue on quarto.org

Description

The example for the link-external-filter config is a bit confusing:

For example ^(?:http:|https:)\/\/www\.quarto\.org\/custom will treat links that start with http://www.quarto.org as internal links

what is that custom doing in the example regex? Is that part of the regex (meaning that it has to be part of the link to be considered internal)? Or is that a special syntax for something?

soxofaan commented 5 days ago

comes from here I think: https://github.com/quarto-dev/quarto-web/blob/main/docs/output-formats/html-basics.qmd#L336-L340

and apparently mentioned here too: https://github.com/quarto-dev/quarto-web/blob/1d47eb81f05ec4b6c48864971a392ef677418eaa/docs/reference/formats/html.json#L444-L445

cscheid commented 5 days ago

I don't think this needs changing. The confusion can be solved by experimenting with the option, and understanding regexes are necessary to using them.

soxofaan commented 4 days ago

I guess I should have expressed this problem less vague.

There is a bug in the documentation, it currently says:

^(?:http:|https:)\/\/www\.quarto\.org\/custom will treat links that start with http://www.quarto.org/ as internal links

Which is wrong: http://www.quarto.org/foo starts with http://www.quarto.org/ but it will not be caught by the regex

I guess the docs should be changed to

^(?:http:|https:)\/\/www\.quarto\.org\/ will treat links that start with http://www.quarto.org/ as internal links

or to

^(?:http:|https:)\/\/www\.quarto\.org\/custom will treat links that start with http://www.quarto.org/custom as internal links

cscheid commented 4 days ago

I gotcha. Can you make a PR?

mcanouil commented 2 days ago

I made the PR: