Literate.jl
Literate.jl copied to clipboard
Proposal: Alternate Julia comment syntax
Hi, as always, thanks for the great work!
This is just a proposal for an alternative syntax for julia comments in code blocks.
The usual style is ## comment and this will render as # comment.
However, ## is one of the code cell delimiters in VSCode (which are not user configurable).
Thus, the usual syntax can hinder a code cell oriented workflow.
I implemented #~, added docs and some tests.
- Of course,
~is up for debate, but it seems to be present on most keyboard layouts and does not clash with comments in code blocks using other languages. - By the replacement rules I placed in "src/Literate.jl", comments like
#~Commentare allowed and render as#Comment.
The usual##requires a blank space. What is the rationale behind this?
Shortly after I had opened this pull request, there was a change in the vscode extension:
https://github.com/julia-vscode/julia-vscode/pull/2567/
Cell delimiters can be configured now.
For example, I disabled the ## delimiter, and in my Literate files I now use #%%#src as my clunky delimiter.
Okay, nice. So this PR isn't needed? Perhaps it can be added to the tips and tricks section in the manual?
At least I am not as desperate for this functionality as i was 3 years ago :grin:
I still think having a configurable comment pattern in Literate.jl would be cool to have, but realistically I won't find time to update this proposal anytime soon. Maybe we can convert this to a draft, so as to not forget about it? But closing is fine with me too.
A note for the vscode configuration in the manual would certainly be nice :) I'll try to open a separate pull request in the coming days.