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

Support for Configuration per Code Block #193

Open
RoyiAvital opened this issue Mar 29, 2022 · 7 comments
Open

Support for Configuration per Code Block #193

RoyiAvital opened this issue Mar 29, 2022 · 7 comments

Comments

@RoyiAvital
Copy link

RoyiAvital commented Mar 29, 2022

It would be great to have a way to configure some settings per block:

  1. Display
    Controls whether to display or not this section.
  2. Execute
    Whether to execute or not this section.
  3. Capture
    Whether to capture the output or not.

For instance, it will allow removing using <somePackage>.

By the way, one of the use cases above it be able to use the run command within the file itself.
Yet if one uses execute = true it seems the procedure will fail (Infinite loop?).

@fredrikekre
Copy link
Owner

fredrikekre commented Mar 30, 2022

I believe all of this is supported already? I don't understand what you mean with the last part.

@RoyiAvital
Copy link
Author

How can I make a chuck execute but without trying to capture its output?
How can I run something without displaying it in the output file?

I don't think you allow this granularity per chunk.

@fredrikekre
Copy link
Owner

Same syntax as Documenter:

$ cat test.jl 
# Executed, no output

x = 1
nothing #hide

# Executed, no output

y = 2;

# Executed but hidden

z = 3 #hide

#-

x + y + z

$ julia -e 'using Literate; Literate.markdown("test.jl"; execute=true)' 2>/dev/null

$ cat test.md 
```@meta
EditURL = "<unknown>/test.jl"
```

Executed, no output

````julia
x = 1
````

Executed, no output

````julia
y = 2;
````

Executed but hidden


````
3
````

````julia
x + y + z
````

````
6
````

@newptcai
Copy link

newptcai commented May 6, 2022

I think the op is asking, how can you hide a whole code block? We can append #hide at the end of each line. But that seems to be a pretty tedious process.

@frankier
Copy link

frankier commented Nov 5, 2022

I am also interested in the possibility of having some blocks not execute e.g. if I have a document with some stuff at the beginning I would like to show, then some interactive (readlines()) parts later on, I might like to execute the earlier cells in a notebook, but leave the later ones unexecuted so as not to block the process.

@abhinavnatarajan
Copy link

abhinavnatarajan commented Dec 5, 2022

I think it would helpful to have per-block code-fencing. Documenter.jl has support for @repl, @example, and @setup which are treated differently. It would be useful to indicate which code blocks to fence in what way. Appending # hide at the end of each line is tedious and also shows up in script output, which is ugly.

@RoyiAvital
Copy link
Author

I see there are changes since this.
Is there a block control in the pipepline?

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

5 participants