Coder Social home page Coder Social logo

Optional tags problem about htm HOT 5 CLOSED

dy avatar dy commented on June 13, 2024
Optional tags problem

from htm.

Comments (5)

developit avatar developit commented on June 13, 2024 1

As of 2.0, htm is an XML dialect in order to match JSX, not an HTML dialect. Optional tags are not supported, instead use XML self-closing tags:

html`<p>P. Sherman<br />
42 Wallaby Way<br />
Sydney</p>`

from htm.

dy avatar dy commented on June 13, 2024

Just stumbled upon this implementing custom tags.
By design, special h function accepts "html spread" <...> tag.
Turns out, htm isn't on good terms with unclosed tags. Using <.../> doesn't seem as elegant.

Just leaving that here.

from htm.

dy avatar dy commented on June 13, 2024

In addition, some other use-cases of unclosed tags left out:

<?xml version="1.0" encoding="UTF-8" ?>
<!doctype html>
<![CDATA[ ...  ]]>
<!-- comment -->
<!--[if expression]> HTML <![endif]-->

Not necessary useful, but little parser improvement (eg. a customizable dict of unclosed tags) could make htm support extended XML markups, not only JSX. That would make it handy for consuming packages, not only direct use.

from htm.

dy avatar dy commented on June 13, 2024

Sorry for bothering with notifications, just one more potentially realistic improvement over JSX.
There's no good way to leave comments in JSX now.
Could be handy to support standard html syntax for them <!-- Commented out parts --> or something alike.

from htm.

dy avatar dy commented on June 13, 2024

In case if someone needs better support for html - there's xhtm - extensible htm version.

from htm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.