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

Markdown parsing errors when format_julia_builds=true or if context is specified #616

Open
jeremiedb opened this issue Jan 10, 2023 · 1 comment
Assignees
Labels

Comments

@jeremiedb
Copy link
Contributor

2 bugs were identified in relation to markdown rendering.

  1. If the Genie.config's watch is set to true, 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

  1. In html function, if context is 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
@jeremiedb jeremiedb changed the title Markdown parsing fails when watch is true and if @__MODULE__ is specified Markdown parsing errors when watch is true or if context is specified Jan 10, 2023
@jeremiedb
Copy link
Contributor Author

jeremiedb commented Jan 11, 2023

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.

@jeremiedb jeremiedb changed the title Markdown parsing errors when watch is true or if context is specified Markdown parsing errors when format_julia_builds=true or if context is specified Jan 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants