Genie.jl
Genie.jl copied to clipboard
Markdown parsing errors when format_julia_builds=true or if context is specified
2 bugs were identified in relation to markdown rendering.
- If the Genie.config's
watchis set totrue, logging throws an error when parsing markdown files:
julia> β Error: 2023-01-10 18:12:49 ErrorException("Parsing error for input occurred on line 14, offset: 6")
β @ Genie.Renderer C:\Users\jerem\.julia\packages\Genie\1kq8p\src\Renderer.jl:388
The error can be reproduced by running the following app (dev branch): https://github.com/jeremiedb/GenieExperiments.jl/tree/dev
Then go to http://127.0.0.1:8000/md2
The actual config line causing the issue is: https://github.com/jeremiedb/GenieExperiments.jl/blob/303f9603eb6f8a9372f5f10adda62837e46d5c02/config/env/dev.jl#L12
- In
htmlfunction, ifcontextis specified as= @__MODULE__, it results error with following stack trace and returns the 500 server error page:
julia> β Error: 2023-01-10 18:14:55 ErrorException("Parsing error for input occurred on line 14, offset: 6")
β @ Genie.Renderer C:\Users\jerem\.julia\packages\Genie\1kq8p\src\Renderer.jl:388
β Error: 2023-01-10 18:14:55 UndefVarError: Markdown not defined
β Stacktrace:
β [1] func_02ecd08a02fbb86188bfb9156e5a7c3519e2b97a(; context::Module)
β @ GenieExperiments C:\Users\jerem\OneDrive\JuliaComputing\GenieExperiements\build\GenieViews\fa603a255743b9d23269a79a4d231b98c1a64971.jl:7
β [2] func_02ecd08a02fbb86188bfb9156e5a7c3519e2b97a()
β @ GenieExperiments C:\Users\jerem\OneDrive\JuliaComputing\GenieExperiements\build\GenieViews\fa603a255743b9d23269a79a4d231b98c1a64971.jl:3
β [3] (::GenieExperiments.var"#36#40")()
β @ GenieExperiments C:\Users\jerem\OneDrive\JuliaComputing\GenieExperiements\build\GenieViews\27897da66801398d0c52e1a583083a5d73dfbb9c.jl:22
β [4] #invokelatest#2
β @ .\essentials.jl:729 [inlined]
β [5] invokelatest
β @ .\essentials.jl:726 [inlined]
It can be reproduced by going to http://127.0.0.1:8000/md1 in the same GenieExperiments app.
The routes is specified as the following: https://github.com/jeremiedb/GenieExperiments.jl/blob/303f9603eb6f8a9372f5f10adda62837e46d5c02/routes.jl#L27-L33:
route("/md1") do
html(
path"views/markdown/blog1.jl.md",
layout = path"layouts/markdown.jl.html",
context = @__MODULE__,
)
end
Which is somewhat puzzling since looking at html source code, it seems like context defaults to @__MODULE__ while the observed behavior is different when not specified as seen in the above /md2 example where rendering succeed (despite the parsing error).
All packages were on latest releases:
Status `C:\Users\jerem\OneDrive\JuliaComputing\GenieExperiements\Project.toml`
[336ed68f] CSV v0.10.9
[aaaa29a8] Clustering v0.14.3
[a93c6f00] DataFrames v1.4.4
[c43c736e] Genie v5.13.0
[6d011eab] Inflector v1.0.1
[e6f89c97] LoggingExtras v1.0.0
[ce6b1742] RDatasets v0.7.7
[2913bbd2] StatsBase v0.33.21
[4acbeb90] Stipple v0.25.15
[ec984513] StipplePlotly v0.13.2
[a3c5d34a] StippleUI v0.21.2
[ade2ca70] Dates
[56ddb016] Logging
I think the watch config option was the wrong diagnosis. It actually looks like it's format_julia_builds = true that results in MD parsing error, sorry about that.