fredrikekre / Literate.jl

Simple package for literate programming in Julia
https://fredrikekre.github.io/Literate.jl
Other
534 stars 61 forks source link

Is it possible to get comments inside a code block while converting to markdown? #217

Closed sathvikbhagavan closed 1 year ago

sathvikbhagavan commented 1 year ago

MWE:

test.jl:

begin
    # this is comment in code
    x = 1
end

If I run

Literate.markdown("test.jl", ".")

I get the following output:

````@example test
begin

this is comment in code

    x = 1
end

instead I want
begin
     # this is comment in code
    x = 1
end


Is this a limitation of Literate.jl or am I doing it incorrectly?
fredrikekre commented 1 year ago

Use double hash for comments

begin
    ## this is comment in code
    x = 1
end

see https://fredrikekre.github.io/Literate.jl/v2/fileformat/#Syntax

sathvikbhagavan commented 1 year ago

Thanks!