Comments (5)
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.
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.
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.
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.
thanks.
feel free to make it yourself.
yes. i would use a concrete parser like
- tree-sitter-html with treesitter-to-unist
- lezer-parser-html to avoid WASM
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)
- Better SVG minification HOT 1
- allowDangerousCharacters is still encoding '&' when its set to true HOT 3
- Head elements are not wrapped in a Head tag HOT 3
- Head elements are not wrapped in a Head tag HOT 7
- Support minifying comments further
- Do not use `Omit` type HOT 9
- Prevent kebab case datatype? HOT 7
- Circular dependencies breaks rollup and vite builds HOT 4
- Text is encoded even when setting allowDangerousCharacters/allowDangerousHtml HOT 6
- failed to compile ts code using hast-util-to-html HOT 5
- Add support to format the HTML in a tidy fashion HOT 9
- `list-style-type` is stringified incorrectly HOT 1
- Force self-closing tags to be manually closed tags HOT 8
- Add missing "type": "module" to package.json for Vite resolution HOT 3
- missing whitespace in root node HOT 2
- Request more control over escaping HOT 6
- Reduce dependencies size HOT 3
- How do I allow camel cased properties? HOT 4
- Do not output unneeded entities in `<script>` or `<style>` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hast-util-to-html.