Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/nim-lang-cn/html2karax
- Owner: nim-lang-cn
- License: mit
- Created: 2019-10-15T13:04:29.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-03-05T05:34:06.000Z (almost 3 years ago)
- Last Synced: 2024-08-01T19:32:08.608Z (5 months ago)
- Language: Nim
- Homepage:
- Size: 2.36 MB
- Stars: 30
- Watchers: 4
- Forks: 2
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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 / preludeproc 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
```