Skip to content

Treat .qmd and .Rmd files as Markdown#2172

Open
mre wants to merge 3 commits intomasterfrom
treat-qmd-rmd-as-markdown
Open

Treat .qmd and .Rmd files as Markdown#2172
mre wants to merge 3 commits intomasterfrom
treat-qmd-rmd-as-markdown

Conversation

@mre
Copy link
Copy Markdown
Member

@mre mre commented Apr 25, 2026

Quarto (.qmd) and R Markdown (.Rmd) are popular Markdown variants. Lychee was parsing them as plaintext, so URLs inside fenced code blocks were extracted as links, including ones with shell substitutions like $(arch) that fail link checks.

This adds qmd and rmd to the list of Markdown extensions. Case-insensitive lookup already handles .Rmd.

Includes fixtures reproducing the example from the issue and CLI tests confirming that real links are extracted while code-block URLs are skipped by default.

Closes #2157

mre added 3 commits April 25, 2026 16:56
Quarto (.qmd) and R Markdown (.Rmd) are popular Markdown variants. Previously they fell through to the plaintext parser, causing URLs inside fenced code blocks to be extracted as links (e.g. shell substitutions like $(arch) producing surprising failures).

Closes #2157
md and markdown come first, followed by mdx, qmd, rmd, then the long tail of legacy extensions.
@mre mre force-pushed the treat-qmd-rmd-as-markdown branch from b3b5331 to 4b57d5e Compare April 25, 2026 15:05
Copy link
Copy Markdown
Member

@katrinafyi katrinafyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The functional change set is fine but this comment and its implications are eyebrow raising. It doesn't need to be fixed in this PR, but also might as well.

impl FileType {
/// All known Markdown extensions
// NOTE: Stored in reverse-popularity order because the `Iterator` impl for
// `FileExtensions` pops from the end
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment really makes me raise an eyebrow at impl Iterator for FileExtensions. Conceptually, I do not think FileExtensions should be a stateful iterator that gets mutated.

Is iterating over FileExtensions even necessary? If iteration is needed, it should delegate to Vec's iterator, or there can just be a function that returns a slice of strings.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, true, that crossed my mind as well. Didn't want to change too much at once, but I could change that in this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Treat .qmd/ .Rmd as markdown

2 participants