This commit is contained in:
Florian Schroedl
2022-05-04 17:00:00 +02:00
parent 468586ffaa
commit 713dd4cb80

View File

@@ -9,6 +9,7 @@ import
import sequtils
import options
import strformat
import fp/maybe
import ../../org/org_block_heading
import ../../org/org_builder
import ../../org/org_types
@@ -29,19 +30,20 @@ proc renderItems(
proc toMarkUp(x: OrgInlineBlock): ReactNode =
console.log(x)
case x.kind:
of orgRawText: `<>`("Foo")
# of orgText: "Text"
of orgRawText: `<>`(x.content)
of orgText: `<>`(x.content)
# # Formating
of orgBoldText: b(Attrs{}, x.content)
# of orgItalicText: "Text (Italic)"
# of orgUnderlineText: "Text (Underline)"
# of orgVerbatimText: "Text (Verbatim)"
# of orgCodeText: "Text (Code)"
# of orgStrikeThroughText: "Text (StrikeThrough)"
of orgItalicText: i(Attrs{}, x.content)
of orgUnderlineText: u(Attrs{}, x.content)
of orgVerbatimText: pre(Attrs{}, x.content)
of orgCodeText: code(Attrs{}, x.content)
of orgStrikeThroughText: p(Attrs{}, x.content)
# # Links
# of orgLink: "Link"
of orgLink: a(Attrs{href: x.linkUrl}, x.linkDescription.getOrElse(x.linkUrl))
else: p(Attrs{}, "Unmatched")
proc makeItems(x: string): seq[ReactNode] =
@@ -55,7 +57,7 @@ proc makeTopLevel(): ReactNode {.exportc.} =
let text = myUseState[cstring]("""* TODO Level 1
Some stuff inbetween
** DONE Level 2 **bold** stuff""")
** DONE Regular *bold* [[https://some.url]] /italic/ _underline_ =verbatim= ~code~ +strikethrough+ [[https://some.url][title]]""")
let val = text.getter
let orgItems = makeItems($val)