https://github.com/timonson/himple
Lightweight tokenizer and syntax highlighter
https://github.com/timonson/himple
syntax-highlighter tokenizer web-components
Last synced: about 1 month ago
JSON representation
Lightweight tokenizer and syntax highlighter
- Host: GitHub
- URL: https://github.com/timonson/himple
- Owner: timonson
- License: mit
- Created: 2020-01-12T21:19:34.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-01-12T21:30:00.000Z (over 6 years ago)
- Last Synced: 2025-04-10T09:48:23.394Z (about 1 year ago)
- Topics: syntax-highlighter, tokenizer, web-components
- Language: JavaScript
- Size: 14.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# himple
Lightweight tokenizer and syntax highlighter
#### The following code will generate a rendered code block...
```html
import createHimple from "./himple.js"
const himple = createHimple()
const codeString = `h(
"ul",
{ class: "demo-switcher" },
listElementContent.map((el, i) =>
h(
"li",
{
onclick: event => change.next(event),
class: i === 0 ? "active-index" : null,
},
el.toString()
)
)
)
`
hFuncString.innerHTML = codeString
himple(hFuncString)
```
#### ... which looks like this

## Credit
Lars Jung and his [lolight project](https://github.com/lrsjng/lolight)