Comments (6)
This project focusses on standards, not on custom non-standard needs.
Disabling escaping would break everything. Allowing to override escape
would break everything.
I don’t think this feature would be enough for you to generate a string for Svelte.
Also sounds like you don’t generate things for Svelte, but for MDsveX. Which is even more different.
What do you want to generate? Why use this project for that? Why not build your own project for Svelte/MDsveX’s format?
Why not use MDX itself, which also works with Svelte?
from hast-util-to-html.
I am using this library to generate strings of highlighted code elements from MDSveX fenced code blocks. I'm using hastscript
to build the hast AST from Shiki generated tokens. It's not necessarily generating anything MDsveX or Svelte specific, but since its processed by MDsveX after being generated, braces need to be escaped.
Everything is currently working beautifully, but I would like more control over escaping special characters. Like I said I thought adding subset
would be better and wasn't sure why the option was disabled. I didn't believe I was inquiring on something that was non-standard, the ability to control which characters of a text value in HTML to escape seemed like it would be a common need.
from hast-util-to-html.
HTML and Svelte templates are related but different, I'd agree with @wooorm that this project focuses HTML, adding Svelte specific escapes doesn't make sense.
A pipeline which would likely make more sense for your use case.
- Start with the Shiki tokens
- Generate a
hast
tree - Translate the
hast
tree to asvast
tree https://github.com/pngwn/MDsveX/tree/master/packages/svast - serialize the
svast
tree withsvast-stringify
https://github.com/pngwn/MDsveX/tree/master/packages/svast-stringify
Or alternatively:
- Start with the Shiki tokens
- Generate a
svast
tree https://github.com/pngwn/MDsveX/tree/master/packages/svast - Serialize the
svast
tree withsvast-stringify
https://github.com/pngwn/MDsveX/tree/master/packages/svast-stringify
In both cases, using svast-stringify
should guarantee compatibly with MDsveX, since it is designed/built to implement MDsveX's own internal AST representation and will include escapes expected by MDsveX.
from hast-util-to-html.
@ChristianMurphy and @wooorm thanks for the advice. I'll take a look at building a svast
tree, rather than hast
.
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.
Hi team! Could you describe why this has been marked as external?
Thanks,
— bb
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
- re: missing whitespace in root node HOT 5
- 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.