File to reproduce (minimal.md):
We want to convert this into an error. In some cases, there may be an
existing error for this scenario. In others, we will need to allocate a
fresh diagnostic code. [Instructions for allocating a fresh diagnostic
code can be found here.](./diagnostics/diagnostic-codes.md) You may want
to mention in the extended description that the compiler behavior
changed on this point, and include a reference to the tracking issue for
the change.
Running
readable check minimal.md
On master and v2.2 it throws error:
ERROR failed to render '/home/muradb/personal/rustc-dev-guide/minimal.md', aborting: Error: Cannot take length of multi-line node '[object Object]'
Toggle full backtrace of error
Error: Cannot take length of multi-line node '[object Object]'
at nodeLength (file:///home/muradb/personal/readable/markdown/ast.ts:92:16)
at ReflowParagraphState.addRawNode (file:///home/muradb/personal/readable/plugins/readable/reflow.ts:84:31)
at processParent (file:///home/muradb/personal/readable/plugins/readable/reflow.ts:288:41)
at reflowParagraph (file:///home/muradb/personal/readable/plugins/readable/reflow.ts:321:3)
at visit (file:///home/muradb/personal/readable/plugins/readable/reflow.ts:335:9)
at file:///home/muradb/personal/readable/plugins/readable/reflow.ts:338:42
at Array.forEach (<anonymous>)
at visit (file:///home/muradb/personal/readable/plugins/readable/reflow.ts:338:23)
at transformer (file:///home/muradb/personal/readable/plugins/readable/reflow.ts:344:5)
at wrapped (https://jspm.dev/npm:[email protected]!cjs:21:19)
Upon further having some console.log s in nodeLength function, it's clear that the error occurs because of link element in the example, specifically when it tries to check for if node is literal:
|
if (isLiteralNode(n)) return n.value.length; |
which link element is not, so it just throws error. I am not sure about the whole codebase, but if you tell me what's it supposed to do when it encounters a link element, I can send a pull request.
File to reproduce (minimal.md):
Running
On master and v2.2 it throws error:
Toggle full backtrace of error
Upon further having some
console.logs innodeLengthfunction, it's clear that the error occurs because of link element in the example, specifically when it tries to check for if node is literal:readable/markdown/ast.ts
Line 90 in 8e53ead
which link element is not, so it just throws error. I am not sure about the whole codebase, but if you tell me what's it supposed to do when it encounters a link element, I can send a pull request.