From 713dd4cb809a4d73ff4ad9ca98d20b64b72e322d Mon Sep 17 00:00:00 2001 From: Florian Schroedl Date: Wed, 4 May 2022 17:00:00 +0200 Subject: [PATCH] Add text --- src/js/example/sandbox.nim | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/js/example/sandbox.nim b/src/js/example/sandbox.nim index cd18144..2cd747e 100644 --- a/src/js/example/sandbox.nim +++ b/src/js/example/sandbox.nim @@ -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)