Giter VIP home page Giter VIP logo

Comments (5)

wooorm avatar wooorm commented on May 26, 2024 1

please feel free to merge the issues

That’s not possible through the GH UI, unfortunately!

making it 100% concrete is a small fix

It’s extremely complex. A concrete tree would house all original sources of character references. It would house whitespace inside tags. It would house the casing of attributes. It would include information on whether double or single quotes are used. It would information in doctypes, processing instructions. It would contain casing of tag names. It would be months of work to create.

at least this could be made optional

It’s a ton of work, probably a full year to implement a new parser and design the data structure. If you are interested in paying me to make it reality I would likely quote you $200k.

the resulting parser may be less "strict" and more "loose" than a perfectly spec-compliant parser ...

This project adheres to the HTML spec.

whats the punishment of breaking the spec?

In this particular case of only the whitespace? It would indeed probably not be terribly complex to implement, but parse5 doesn’t support it either. Feel free to investigate.

But we have had similar conversations about this: hast is for the HTML spec. If you want XML, use xast. If you want to use a different project that does not adhere to the spec, feel free to make it yourself.

from hast-util-to-html.

wooorm avatar wooorm commented on May 26, 2024

You can still comment on closed issues.

This isn’t about valid or invalid.
This is about the HTML standard prescribing how to parse HTML.
We follow how the HTML standards prescribes how to parse HTML.

We use an AST (abstract). Not a CST (concrete). We don’t generate the exact input document. We generate an equivalent document.

from hast-util-to-html.

github-actions avatar github-actions commented on May 26, 2024

Hi! This was closed. Team: If this was fixed, please add phase/solved. Otherwise, please add one of the no/* labels.

from hast-util-to-html.

milahu avatar milahu commented on May 26, 2024

sorry .__.
please feel free to merge the issues

We follow how the HTML standards prescribes how to parse HTML.

rendering html != transforming html

We use an AST (abstract). Not a CST (concrete). We don’t generate the exact input document. We generate an equivalent document.

the parse tree is 99% concrete already.
it contains all the whitespce, except around the root node.
making it 100% concrete is a small fix with a large gain (at least for my use case).
at least this could be made optional

the resulting parser may be less "strict" and more "loose" than a perfectly spec-compliant parser ...
but so what? whats the punishment of breaking the spec?
except that html rendering is 0.1% slower, to skip some whitespace nodes

from hast-util-to-html.

milahu avatar milahu commented on May 26, 2024

thanks.

feel free to make it yourself.

yes. i would use a concrete parser like

with a different transformer (different node names, different data structure)
which is cheap, because my transformer is simple

edit: for my use case "html to html transformer"
i would use a different framework, probably eslint
where i have concrete parsers by default
and where i can modify the source string (not modify the parse tree)

from hast-util-to-html.

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.