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

Inconsistent Documenter rendering between code execution in Literate.jl and Documenter.jl #178

Open
racinmat opened this issue Nov 26, 2021 · 2 comments

Comments

@racinmat
Copy link

racinmat commented Nov 26, 2021

I'm not sure if this is issue on side of Literate, or Documenter, or both and fix needs to be applied to both of them.

When I generate markdown, execute it, and generate html site, the output is colored differently than when @example is executed using Documenter.
Here is a MWE:

using Pkg
cd(@__DIR__)
pkg"activate ."
using Literate, Documenter

open("script.jl", "w+") do io
    write(io, """
    a = 2 + 2
    """)
end

Literate.markdown("script.jl", "src", execute=true, credit=false)

open("src/index.md", "w+") do io
    write(io, """
    ```@example
    a = 2 + 2
    ```
    """)
end

makedocs(
    sitename = "Test",
    pages = [
        "Home" => "index.md",
        "Script from Literate" => "script.md",
    ],
)

The Home looks like this:
image
and Script from Literate like this:
image

specifically, when executed by documenter, generated code is

    <article class="content" id="documenter-page">
        <pre><code class="language-julia hljs">a = 2 + 2</code></pre>
        <pre class="documenter-example-output"><code class="nohighlight hljs ansi">4</code></pre>
    </article>

and when by literate, generated code is

    <article class="content" id="documenter-page">
        <pre><code class="language-julia hljs">a = 2 + 2</code></pre>
        <pre><code class="nohighlight hljs">4</code></pre>
    </article>
@fredrikekre
Copy link
Owner

It is not really a bug/issue with either Literate or Documenter, it is just how things work. Documenter knows what it generates and insert those classes, but when you execute with Literate the result will look like regular code blocks (```-blocks with no language) from Documenters perspective.

@racinmat
Copy link
Author

I know.
Would it make sense to add some ```` block, e.g. julia-output and then add feature to Documenter so it would properly color them?

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