earl-quaint

Macros to embed Quaint in Earl Grey programs

Usage no npm install needed!

<script type="module">
  import earlQuaint from 'https://cdn.skypack.dev/earl-quaint';
</script>

README

earl-quaint

This packages defines the Q macro which allows the embedding of Quaint markup in Earl Grey.

require-macros:
   earl-quaint ->
      Q

Q"Hello __everyone!"  ;; => % {"Hello", strong % "everyone"}

The result is an ENode, the same data structure that the % operator returns in Earl Grey. An ENode can be converted to HTML:

require-macros:
   earl-quaint ->
      Q

require: /html

html(Q"Hello __everyone!")  ;; => "Hello <strong>everyone</strong>"

Alternatively, you can specify a format to convert to directly:

require-macros:
   earl-quaint ->
      Q(format = "html")

Q"Hello __everyone!"  ;; => % "Hello <strong>everyone</strong>"

Earl Grey expressions can be interpolated inside {}s.

favorites = {
   animal = "zebra"
   food = "poutine"
}

Q"My favorite animal is the {favorites.animal}"

Finally, it is possible to alias Q to the single quote:

require-macros:
   earl-quaint ->
      Q(format = "html") as "'"

'Hello __world'  ;; => "Hello <strong>world</strong>"