Closed lucaferranti closed 2 years ago
Similar issue for markdown strings, using
md"""
# Title
## Subtitle
some text
"""
a = 1
b = 2
# some more text
c = a + b
and calling Literate.markdown("test_file.jl"; mdstrings=true)
produces
```@meta
EditURL = "<unknown>/test_file.jl"
md"""
Title
# Subtitle
some text
"""
a = 1
b = 2
some more text
c = a + b
This page was generated using Literate.jl.
I think this is a windows related issue, because on linux both seem to work as expected. My guess would be that windows doesn't understand the regexes at these lines.
I thought this would have been fixed by https://github.com/fredrikekre/Literate.jl/pull/167. What version of Literate are you using?
2.9.3
I played with the code a little, the current regexes are
content = replace_multiline(r"^#=+\R^(\X*?)\R=+#$"m, content)
if config["mdstrings"]::Bool
content = replace_multiline(r"^md\"\"\"\R^(\X*?)\R\"\"\"$"m, content)
end
removing the $
from the regexes makes it work. I think the reason is that if you have
#=
blah blah
=#
a = 1
then you have an invisible new line character after =#
and hence the regex doesn't match it since the =#$
matches a line that ends with =#
.
note: I haven't checked (yet) whether this change breaks the behavior on other OSs, I can test on a linux machine later today
Yea I am working on a fix. Just confused why the tests I added in #167 pass...
maybe it's because the current tests have
write(inputfile, "#=\r\nhello world\r\nhej världen\r\n=#")
so in that case =#
is indeed at the end of the line. I changed that line to
write(inputfile, "#=\r\nhello world\r\nhej världen\r\n=#\r\na=1")
and then chunks[2].lines
returns
["#=", "hello world", "hej världen", "=#", "a=1"]
after removing the $
from the regex the tests pass again
Description
I have a file
test_file.jl
with contentafter calling
Literate.markdown("test_file.jl")
the output intest_file.md
isTitle
some more text
This page was generated using Literate.jl.