You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello! I love this project! For my purposes, I've been making a Visitor that renders markdown text to SwiftUI Views. However, accessing any data of a node leads to the following error:
Fatal error: Couldn't wrap node of type: cmark_node_type(rawValue: 0): file .../BaseNode.swift, line 23
The code breaks on the line I print node.children in rendering a heading node in my visitor class (but the same error occurs on other nodes as well):
func visit(heading node:Heading)->Result{print("Heading node \(node)")print("Children are \(node.children)")print("Depth is \(node.nestDepth)")returnAnyView(EmptyView())}
This is where I initiate the AST traversal:
// text is equal to "### First block"
letnode=tryDown(markdownString: text).toAST().wrap()as!Document
// let st = node.accept(AttributedStringVisitor(styler: DownStyler()))
// print(String(reflecting: st))
return node.accept(Viewer())
The confusing part is, this error only happens occasionally, and if I uncomment the code above that uses the default styler traversal, the code always runs fine, which makes me think it has to do with a problem with the lazy variables I'm using. Does anyone have any insight on this?
The text was updated successfully, but these errors were encountered:
Hi there 👋 Please consider asking general questions about working with cmark and Down on StackOverflow.com rather than here. The only issues that should be filed on this GitHub repo is if it's a bug in Down that needs addressing. Thanks!
iwasrobbed-ks
changed the title
Creating a new Visitor leads to wrapping value error
[StackOverflow] Creating a new Visitor leads to wrapping value error
Jun 15, 2020
Hello! I love this project! For my purposes, I've been making a
Visitor
that renders markdown text to SwiftUI Views. However, accessing any data of a node leads to the following error:The code breaks on the line I print
node.children
in rendering a heading node in my visitor class (but the same error occurs on other nodes as well):This is where I initiate the AST traversal:
The confusing part is, this error only happens occasionally, and if I uncomment the code above that uses the default styler traversal, the code always runs fine, which makes me think it has to do with a problem with the lazy variables I'm using. Does anyone have any insight on this?
The text was updated successfully, but these errors were encountered: