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

Folding code blocks but not the output (e.g. figures) [FR] #477

Open
nathanaelbosch opened this issue Nov 15, 2023 · 1 comment
Open

Folding code blocks but not the output (e.g. figures) [FR] #477

nathanaelbosch opened this issue Nov 15, 2023 · 1 comment

Comments

@nathanaelbosch
Copy link

A similar issue (#425) requests foldable code blocks, and a comment also provides a simple solution to get the desired result. However, surrounding a code block with <details> and </details> would also hide the output generated by Weave.jl, such as a figure. Is there any way to hide the code, but not the output?

@nathanaelbosch nathanaelbosch changed the title Folding code blocks _but not the output such as figures_ [FR] Folding code blocks but not the output (e.g. figures) [FR] Nov 15, 2023
@nathanaelbosch
Copy link
Author

A quick and hacky implementation of this:

Weave.register_format!("custom", Weave.GitHubMarkdown(
    codestart="""
    ```@raw html
    <details><summary>Code:</summary>
    ```
    ```julia""",
    codeend="""
    ```
    ```@raw html
    </details>
    ```
    """,
))

This makes all code folded in a <details> block with summary Code:. This works well enough for my use-case, but I think a chunk option could still be valuable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant