<a>
element # Create an <a> element
@a
# Create an <a> element with class='className'
@a .className
# Create an <a> element with id='idName'
@a #idName
# Create an <a> element with id='idName' and class='className'
@a #idName.className
# Chain multiple classes without spaces
@a #idName.className.otherClassName
<b>
element # Create a <b> element
@b
# Create a <b> element with class='className'
@b .className
# Create a <b> element with id='idName'
@b #idName
# Create a <b> element with id='idName' and class='className'
@b #idName.className
# Chain multiple classes without spaces
@b #idName.className.otherClassName
<br>
element # Create a <br> element
@br
# Create a <br> element with class='className'
@br .className
# Create a <br> element with id='idName'
@br #idName
# Create a <br> element with id='idName' and class='className'
@br #idName.className
# Chain multiple classes without spaces
@br #idName.className.otherClassName
<button>
element # Create a <button> element
@button
# Create a <button> element with class='className'
@button .className
# Create a <button> element with id='idName'
@button #idName
# Create a <button> element with id='idName' and class='className'
@button #idName.className
# Chain multiple classes without spaces
@button #idName.className.otherClassName
<div>
element # Create a <div> element
@div
# Create a <div> element with class='className'
@div .className
# Create a <div> element with id='idName'
@div #idName
# Create a <div> element with id='idName' and class='className'
@div #idName.className
# Chain multiple classes without spaces
@div #idName.className.otherClassName
<form>
element # Create a <form> element
@form
# Create a <form> element with class='className'
@form .className
# Create a <form> element with id='idName'
@form #idName
# Create a <form> element with id='idName' and class='className'
@form #idName.className
# Chain multiple classes without spaces
@form #idName.className.otherClassName
<h1>
element # Create an <h1> element
@h1
# Create an <h1> element with class='className'
@h1 .className
# Create an <h1> element with id='idName'
@h1 #idName
# Create an <h1> element with id='idName' and class='className'
@h1 #idName.className
# Chain multiple classes without spaces
@h1 #idName.className.otherClassName
<h2>
element # Create an <h2> element
@h2
# Create an <h2> element with class='className'
@h2 .className
# Create an <h2> element with id='idName'
@h2 #idName
# Create an <h2> element with id='idName' and class='className'
@h2 #idName.className
# Chain multiple classes without spaces
@h2 #idName.className.otherClassName
<h3>
element # Create an <h3> element
@h3
# Create an <h3> element with class='className'
@h3 .className
# Create an <h3> element with id='idName'
@h3 #idName
# Create an <h3> element with id='idName' and class='className'
@h3 #idName.className
# Chain multiple classes without spaces
@h3 #idName.className.otherClassName
<h4>
element # Create an <h4> element
@h4
# Create an <h4> element with class='className'
@h4 .className
# Create an <h4> element with id='idName'
@h4 #idName
# Create an <h4> element with id='idName' and class='className'
@h4 #idName.className
# Chain multiple classes without spaces
@h4 #idName.className.otherClassName
<h5>
element # Create an <h5> element
@h5
# Create an <h5> element with class='className'
@h5 .className
# Create an <h5> element with id='idName'
@h5 #idName
# Create an <h5> element with id='idName' and class='className'
@h5 #idName.className
# Chain multiple classes without spaces
@h5 #idName.className.otherClassName
<h6>
element # Create an <h6> element
@h6
# Create an <h6> element with class='className'
@h6 .className
# Create an <h6> element with id='idName'
@h6 #idName
# Create an <h6> element with id='idName' and class='className'
@h6 #idName.className
# Chain multiple classes without spaces
@h6 #idName.className.otherClassName
<hr>
element # Create an <hr> element
@hr
# Create an <hr> element with class='className'
@hr .className
# Create an <hr> element with id='idName'
@hr #idName
# Create an <hr> element with id='idName' and class='className'
@hr #idName.className
# Chain multiple classes without spaces
@hr #idName.className.otherClassName
<i>
element # Create an <i> element
@i
# Create an <i> element with class='className'
@i .className
# Create an <i> element with id='idName'
@i #idName
# Create an <i> element with id='idName' and class='className'
@i #idName.className
# Chain multiple classes without spaces
@i #idName.className.otherClassName
<img>
element # Create an <img> element
@img
# Create an <img> element with class='className'
@img .className
# Create an <img> element with id='idName'
@img #idName
# Create an <img> element with id='idName' and class='className'
@img #idName.className
# Chain multiple classes without spaces
@img #idName.className.otherClassName
<input>
element # Create an <input> element
@input
# Create an <input> element with class='className'
@input .className
# Create an <input> element with id='idName'
@input #idName
# Create an <input> element with id='idName' and class='className'
@input #idName.className
# Chain multiple classes without spaces
@input #idName.className.otherClassName
<label>
element # Create a <label> element
@label
# Create a <label> element with class='className'
@label .className
# Create a <label> element with id='idName'
@label #idName
# Create a <label> element with id='idName' and class='className'
@label #idName.className
# Chain multiple classes without spaces
@label #idName.className.otherClassName
<li>
element # Create an <li> element
@li
# Create an <li> element with class='className'
@li .className
# Create an <li> element with id='idName'
@li #idName
# Create an <li> element with id='idName' and class='className'
@li #idName.className
# Chain multiple classes without spaces
@li #idName.className.otherClassName
<link>
element # Create a <link> element
@link
# Create a <link> element with class='className'
@link .className
# Create a <link> element with id='idName'
@link #idName
# Create a <link> element with id='idName' and class='className'
@link #idName.className
# Chain multiple classes without spaces
@link #idName.className.otherClassName
<meta>
element # Create a <meta> element
@meta
# Create a <meta> element with class='className'
@meta .className
# Create a <meta> element with id='idName'
@meta #idName
# Create a <meta> element with id='idName' and class='className'
@meta #idName.className
# Chain multiple classes without spaces
@meta #idName.className.otherClassName
<ol>
element # Create an <ol> element
@ol
# Create an <ol> element with class='className'
@ol .className
# Create an <ol> element with id='idName'
@ol #idName
# Create an <ol> element with id='idName' and class='className'
@ol #idName.className
# Chain multiple classes without spaces
@ol #idName.className.otherClassName
<option>
element # Create an <option> element
@option
# Create an <option> element with class='className'
@option .className
# Create an <option> element with id='idName'
@option #idName
# Create an <option> element with id='idName' and class='className'
@option #idName.className
# Chain multiple classes without spaces
@option #idName.className.otherClassName
<p>
element # Create a <p> element
@p
# Create a <p> element with class='className'
@p .className
# Create a <p> element with id='idName'
@p #idName
# Create a <p> element with id='idName' and class='className'
@p #idName.className
# Chain multiple classes without spaces
@p #idName.className.otherClassName
<pre>
element # Create a <pre> element
@pre
# Create a <pre> element with class='className'
@pre .className
# Create a <pre> element with id='idName'
@pre #idName
# Create a <pre> element with id='idName' and class='className'
@pre #idName.className
# Chain multiple classes without spaces
@pre #idName.className.otherClassName
<select>
element # Create a <select> element
@select
# Create a <select> element with class='className'
@select .className
# Create a <select> element with id='idName'
@select #idName
# Create a <select> element with id='idName' and class='className'
@select #idName.className
# Chain multiple classes without spaces
@select #idName.className.otherClassName
<span>
element # Create a <span> element
@span
# Create a <span> element with class='className'
@span .className
# Create a <span> element with id='idName'
@span #idName
# Create a <span> element with id='idName' and class='className'
@span #idName.className
# Chain multiple classes without spaces
@span #idName.className.otherClassName
<style>
element # Create a <style> element
@style
# Create a <style> element with class='className'
@style .className
# Create a <style> element with id='idName'
@style #idName
# Create a <style> element with id='idName' and class='className'
@style #idName.className
# Chain multiple classes without spaces
@style #idName.className.otherClassName
<table>
element # Create a <table> element
@table
# Create a <table> element with class='className'
@table .className
# Create a <table> element with id='idName'
@table #idName
# Create a <table> element with id='idName' and class='className'
@table #idName.className
# Chain multiple classes without spaces
@table #idName.className.otherClassName
<tbody>
element # Create a <tbody> element
@tbody
# Create a <tbody> element with class='className'
@tbody .className
# Create a <tbody> element with id='idName'
@tbody #idName
# Create a <tbody> element with id='idName' and class='className'
@tbody #idName.className
# Chain multiple classes without spaces
@tbody #idName.className.otherClassName
<td>
element # Create a <td> element
@td
# Create a <td> element with class='className'
@td .className
# Create a <td> element with id='idName'
@td #idName
# Create a <td> element with id='idName' and class='className'
@td #idName.className
# Chain multiple classes without spaces
@td #idName.className.otherClassName
<textarea>
element # Create a <textarea> element
@textarea
# Create a <textarea> element with class='className'
@textarea .className
# Create a <textarea> element with id='idName'
@textarea #idName
# Create a <textarea> element with id='idName' and class='className'
@textarea #idName.className
# Chain multiple classes without spaces
@textarea #idName.className.otherClassName
<th>
element # Create a <th> element
@th
# Create a <th> element with class='className'
@th .className
# Create a <th> element with id='idName'
@th #idName
# Create a <th> element with id='idName' and class='className'
@th #idName.className
# Chain multiple classes without spaces
@th #idName.className.otherClassName
<thead>
element # Create a <thead> element
@thead
# Create a <thead> element with class='className'
@thead .className
# Create a <thead> element with id='idName'
@thead #idName
# Create a <thead> element with id='idName' and class='className'
@thead #idName.className
# Chain multiple classes without spaces
@thead #idName.className.otherClassName
<tr>
element # Create a <tr> element
@tr
# Create a <tr> element with class='className'
@tr .className
# Create a <tr> element with id='idName'
@tr #idName
# Create a <tr> element with id='idName' and class='className'
@tr #idName.className
# Chain multiple classes without spaces
@tr #idName.className.otherClassName
<ul>
element # Create a <ul> element
@ul
# Create a <ul> element with class='className'
@ul .className
# Create a <ul> element with id='idName'
@ul #idName
# Create a <ul> element with id='idName' and class='className'
@ul #idName.className
# Chain multiple classes without spaces
@ul #idName.className.otherClassName
<vr>
element # Create a <vr> element
@vr
# Create a <vr> element with class='className'
@vr .className
# Create a <vr> element with id='idName'
@vr #idName
# Create a <vr> element with id='idName' and class='className'
@vr #idName.className
# Chain multiple classes without spaces
@vr #idName.className.otherClassName
<style>
element to the <head>
@css
.some-class {
display: none;
}
@html
<b>Bold</b> <i>Italic</i> <u>Underlined</u>
<a>
element, with the href set to the link specified in the parameters. <script>
element to the <body>
)
It is not placed at the end of the body like the @script
entity @js
const a = 1
alert(a)
<body>
@script [http://example.com/script.js]
@script [/path/to/script.js]
<head>
@stylesheet [http://example.com/style.css]
@stylesheet [/path/to/style.css]
<title>
element to the <head>
@title [Page Title]
require('quantum-html')
.
For information about different versions, see the Changelog const quantum = require('quantum-core')
function (selection) {
return quantum.isSelection(selection) ? selection.cs() : selection
}
require('quantum-html').entityTransforms()
<meta name="viewport" content="width=device-width, initial-scale=1">
true
content
to an HTML string and gives the dest
of the file the .html
extension. quantum-dom
when stringifying content to make sure files are included from the correct folder. undefined
assetPath
directory. true
name.html
to name/index.html
and leaves index.html
as it is. index.html
and therefore don't need to be directly referenced (e.g. example.com/my-page/
instead of example.com/my-page.html
const html = require('quantum-html')
function customTransform (selection, transformer) {
return html.paragraphTransform(selection, transformer)
}
@customTransform
Content separated with a single
newline will
be grouped
into
a single
paragraph.
Whereas content
Separated by multiple newlines
Will be made into separate paragraphs
<p>
elements (represented in quantum-dom)
const entityTransforms = {
aNamespace: {
aTransform: aFunction,
bNamespace: {
bTransform: bFunction
}
},
bTransform: lastDefinedFunction
}
const flattenedTransforms = prepareTransforms(entityTransforms)
{
'aTransform': aFunction,
'aNamespace.aTransform': aFunction,
// The last defined function with a given namespace will be used as the 'top level' transform
'bTransform': lastDefinedFunction,
'bNamespace.bTransform': bFunction
}
Transform
functions to flatten.