Skip to content

timonson/himple

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

himple

Lightweight tokenizer and syntax highlighter

The following code will generate a rendered code block...

<body>
  <pre><code id="hFuncString"></code></pre>
  <script type="module">
    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)
  </script>
</body>

... which looks like this

Credit

Lars Jung and his lolight project

About

Lightweight tokenizer and syntax highlighter

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published