Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nim-lang-cn/html2karax

Converts static html to Karax in Nim
https://github.com/nim-lang-cn/html2karax

Last synced: about 2 months ago
JSON representation

Converts static html to Karax in Nim

Awesome Lists containing this project

README

        

# html2karax
Converts static html to Karax single page application or server sider rendering.

## Installation

```
nimble install html2karax
```

## Usage

```
html2karax yourHtmlFile.html
```

**yourHtmlFile.html**

```html


___________________________
< I'm an expert in my field. >
---------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||


A cow saying, "I'm an expert in my field." The cow is illustrated using preformatted text characters.

```

**yourHtmlFile.nim**

```nim
include karax / prelude

proc createDom(): VNode =
result = buildHtml:
figure(role = "img", aria-labelledby = "cow-caption"):
pre:
text """
___________________________
< I'm an expert in my field. >
---------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
"""
figcaption(id = "cow-caption"):
text "A cow saying, \"I'm an expert in my field.\" The cow is illustrated using "
em:
text "preformatted"
text " text characters."

setRenderer createDom
```