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

Custom code fence per code block #264

Open
efaulhaber opened this issue Nov 20, 2024 · 3 comments
Open

Custom code fence per code block #264

efaulhaber opened this issue Nov 20, 2024 · 3 comments

Comments

@efaulhaber
Copy link

According to the docs,

  • The default code fence will change from

    ```julia
    # code
    ```
    

    to Documenters @example blocks:

    ```@examples $(name)
    # code
    ```
    

And in the config, I noticed that this can be changed with codefence.
However, I would like to use a different fence only a single code block, which should read

```@cast
# code
```

to use Asciicast.jl. See the docs here. Of course, I don't want all blocks to generate Asciinema output.

Is this currently possible?

@fredrikekre
Copy link
Owner

You can do

# ```@cast
# # code
# ```

@efaulhaber
Copy link
Author

Cool! But then I would have to do something like

# ```@cast
# my_code()
# ```
my_code() #!md

so that my_code() is

  1. run when I include the file,
  2. included in the notebook and
  3. not executed twice in Documenter.jl.

Right?

@fredrikekre
Copy link
Owner

Yes. If you have more code that depends on this I think you need to evaluate it twice anyway (otherwise the variables won't be in the same anonymous module).

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

2 participants