Introduce quarto canonicalize
subcommand to normalize (R/Quarto) Markdown input
#9476
salim-b
started this conversation in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description
I like and use RStudio’s Markdown canonicalization feature a lot. As far as I understand, it is implemented by basically sending the document to a Pandoc "round trip" on save with additional special processing for code chunks (which Pandoc wouldn't preserve by itself) plus some other stuff like citations1.
First I thought, the Markdown canonicalization code was part of RStudio. Then @kevinushey kindly pointed out to me that Quarto (Visual Editor) was actually responsible for this, see i.a.:
I think it would totally make sense to expose this functionality in the Quarto CLI via a dedicated subcommand like
quarto canonicalize
, so people can reproduce the canonicalization outside of RStudio!For the time being, I wrote myself a little POSIX-compliant shell script to reproduce this – for Markdown input only, i.e. without proper support for code chunks aka code cells. I haven't tested it too thoroughly yet, so don't expect it to reproduce RStudio's output in all edge cases (especially regarding the peculiar file-name-ID-prefixing). It also doesn't escape
@
chars that are not part of a citation (like GitHub usernames etc.) on purpose, since I think this sucks a lot. It's hopefully a stop-gap solution, anyways.Footnotes
Which repeatedly proved to be buggy at times. But nevertheless, I think the overall idea of automatic Markdown source normalization is absolutely compelling. ↩
Beta Was this translation helpful? Give feedback.
All reactions