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