LuxDL / DocumenterVitepress.jl

Documentation with Documenter.jl and VitePress
https://luxdl.github.io/DocumenterVitepress.jl/
MIT License
63 stars 9 forks source link

fails to render: <cond> *and then* <statement> #101

Closed lazarusA closed 3 months ago

lazarusA commented 3 months ago

if there is something like this in a md file:

something <cond> *and then* <statement> more something. 

we get a failure.

x Build failed in 394ms
✖ building client + server bundles...
build error:
SyntaxError: Element is missing end tag.
    at createCompilerError (/Users/lalonso/Documents/DocumenterVitepress.jl/docs/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js:1325:17)
    at emitError (/Users/lalonso/Documents/DocumenterVitepress.jl/docs/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js:2788:5)
    at Object.onclosetag (/Users/lalonso/Documents/DocumenterVitepress.jl/docs/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js:2182:13)
    at Tokenizer.stateInClosingTagName (/Users/lalonso/Documents/DocumenterVitepress.jl/docs/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js:749:16)
    at Tokenizer.parse (/Users/lalonso/Documents/DocumenterVitepress.jl/docs/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js:1107:16)
    at Object.baseParse (/Users/lalonso/Documents/DocumenterVitepress.jl/docs/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js:2820:13)
    at Object.parse (/Users/lalonso/Documents/DocumenterVitepress.jl/docs/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js:633:23)
    at Object.parse$2 [as parse] (/Users/lalonso/Documents/DocumenterVitepress.jl/docs/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:1851:24)
    at createDescriptor (file:///Users/lalonso/Documents/DocumenterVitepress.jl/docs/node_modules/@vitejs/plugin-vue/dist/index.mjs:74:43)
    at transformMain (file:///Users/lalonso/Documents/DocumenterVitepress.jl/docs/node_modules/@vitejs/plugin-vue/dist/index.mjs:2367:34)
ERROR: failed process: Process(`/Users/lalonso/.julia/artifacts/e972793fde0fa31a7fc77a58fa34e5ebd54e6658/bin/npm run docs:build`, ProcessExited(1)) [1]

Stacktrace:
  [1] pipeline_error
    @ ./process.jl:565 [inlined]
  [2] run(::Cmd; wait::Bool)
    @ Base ./process.jl:480
  [3] run
    @ ./process.jl:477 [inlined]
  [4] (::DocumenterVitepress.var"#7#9"{MarkdownVitepress, String})()
    @ DocumenterVitepress ~/Documents/DocumenterVitepress.jl/src/writer.jl:187
  [5] cd(f::DocumenterVitepress.var"#7#9"{MarkdownVitepress, String}, dir::String)
    @ Base.Filesystem ./file.jl:112
  [6] render(doc::Documenter.Document, settings::MarkdownVitepress)
    @ DocumenterVitepress ~/Documents/DocumenterVitepress.jl/src/writer.jl:179
  [7] runner(::Type{DocumenterVitepress.MarkdownFormat}, fmt::MarkdownVitepress, doc::Documenter.Document)
    @ DocumenterVitepress ~/Documents/DocumenterVitepress.jl/src/DocumenterVitepress.jl:27
  [8] dispatch(::Type{Documenter.FormatSelector}, ::MarkdownVitepress, ::Vararg{Any})
    @ Documenter.Selectors ~/.julia/packages/Documenter/2OZOh/src/utilities/Selectors.jl:170
  [9] render(doc::Documenter.Document)
    @ Documenter ~/.julia/packages/Documenter/2OZOh/src/writers.jl:45
 [10] runner(::Type{Documenter.Builder.RenderDocument}, doc::Documenter.Document)
    @ Documenter ~/.julia/packages/Documenter/2OZOh/src/builder_pipeline.jl:258
 [11] dispatch(::Type{Documenter.Builder.DocumentPipeline}, x::Documenter.Document)
    @ Documenter.Selectors ~/.julia/packages/Documenter/2OZOh/src/utilities/Selectors.jl:170
 [12] #85
    @ ~/.julia/packages/Documenter/2OZOh/src/makedocs.jl:248 [inlined]
 [13] withenv(::Documenter.var"#85#87"{Documenter.Document}, ::Pair{String, Nothing}, ::Vararg{Pair{String, Nothing}})
    @ Base ./env.jl:257
 [14] #84
    @ ~/.julia/packages/Documenter/2OZOh/src/makedocs.jl:247 [inlined]
 [15] cd(f::Documenter.var"#84#86"{Documenter.Document}, dir::String)
    @ Base.Filesystem ./file.jl:112
 [16] #makedocs#83
    @ ~/.julia/packages/Documenter/2OZOh/src/makedocs.jl:247 [inlined]
 [17] top-level scope
    @ ~/Documents/DocumenterVitepress.jl/docs/make.jl:4
asinghvi17 commented 3 months ago

Ah! That's what it is. Vitepress is assuming they are HTML tags.

We could escape all <> in the markdown...that would solve it nicely. Maybe as an element in the MarkdownAST.Paragraph or MarkdownAST.Text renderers?

lazarusA commented 3 months ago

also, this one doesn't work:

```sshflags=`-i <keyfile>` ```
lazarusA commented 3 months ago

and hopefully last one I saw:

### [wiki](https://www.wikipedia.org) (Wikipidia example)

its changed into

[wiki](https://www.wikipedia.org/) (Wikipidia example) {#[wiki](https://www.wikipedia.org/)-(Wikipidia-example)}

by DV, it should be left unchanged.

The additional string seems to be a combination of the actual link and the text in parenthesis.

asinghvi17 commented 3 months ago

I'll have to check to see if Vitepress auto-slugifies. But in that case, custom IDs still need to be printed this way so it may just be more convenient.

I guess this needs a more thorough "plaintext rendering" system...