Build HTML from Guido Interface Language.
The package expects a global document
(can be provided by jsdom).
If you are interested in using it in CommonJS syntax, please fill an issue
(see link at the bottom of this file).
The code can be used as an ES Module
import { el } from '@guido.software/guido-builder-el'
or as IIFE:
<script src="./js/vendor/el.min.js"></script>
<script>window.el = window.software.guido.builders.el.el</script>
Then use it as:
console.log(el(['div']).outerHTML);
// => <div></div>
console.log(el(['div', ['without', 'meaning']]).outerHTML);
// => <div class="without meaning"></div>
console.log(el(['div', [], {'data-without', 'meaning'}]).outerHTML);
// => <div data-without="meaning"></div>
console.log(el(['div', [], {}, 'without meaning']).outerHTML);
// => <div>without meaning</div>
console.log(el(['div', [], {}, '', [['span', [], {}, 'without meaning' ]] ]).outerHTML);
// => <div><span>without meaning</span></div>
This builder expects a GIL object. GIL stands for Guido Interface Language. It is a JSON-serialisable representation of a view. The focus is on DOM, but it can be extended to support other markup languages as well.
This builder will generate HTML from such an object.
With npm:
npm install @guido.software/guido-builder-el
With yarn
yarn add @guido.software/guido-builder-el
The code is mirrored on Codeberg in case you want to report errors. I don't accept registrations on my Forgejo instance.
AGPL version 3 or newer. See LICENSE