Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide clode blocks? #232

Open
mtiller-jh opened this issue Nov 22, 2023 · 2 comments
Open

Hide clode blocks? #232

mtiller-jh opened this issue Nov 22, 2023 · 2 comments

Comments

@mtiller-jh
Copy link

I am aware that if I add #hide to the end of a line of Julia code, that line is executed but not rendered. I'm also aware that if I have a block of code and I want to execute it but not render it, I can also prepend #hide to each line.

But it is inconvenient to apply these changes to each line. VS Code, for example, can comment and uncomment lines but not (that I am aware) with an additional bit of text. So if I uncomment all these lines with #hide at the start, I just get a bunch of Julia code with the token hide on each line. So toggling back and forth isn't so easy.

I looked through the documentation and I didn't see any way to fence an entire chunk of code in this way. Something along the lines of:

#begin hide
Some Julia code I want to run, but not show
potentially spanning
many,
many 
lines
#end hide 

But I just wanted to check here to see if I was missing anything (or perhaps some other way to achieve the same result).

Thanks.
@RoyCCWang
Copy link

I just use multi-cursor to insert #hide in VS Code:
Highlight lines in VS Code, then alt-shift-I (tested on Linux), press END on keyboard, and type #hide. There are a few guides on the internet on multi-cursor hotkeys and workflows in VS Code.
You'll need to manually delete the #hide inserted on blank lines though.

I hope this is an acceptable work-around for now.

@tpoisot
Copy link

tpoisot commented Oct 17, 2024

This something you can sort of achieve with preprocess -- I have used it e.g. here

https://github.com/PoisotLab/SpeciesDistributionToolkit.jl/blob/main/docs/make.jl#L17-L36

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

No branches or pull requests

3 participants