JSFiddle - React, Tailwind, and code Playground
by mcsf
JavaScript
const TAGS = [
"p",
"h1", "h2", "h3", "h4", "h5", "h6",
"ul", "ol", "li",
]
for (const tag of TAGS) {
String.prototype[tag] = function() {
return `<${tag}>${this}</${tag}>`;
}
}
document.body.innerHTML += "Hi!".h2()
document.body.innerHTML += ("I have a " + "link".link("https://example.org") + " for you!" + "1".sup()).p()
document.body.innerHTML += ("One".italics().li() + "Two".fixed().li()).ul()