menu
Channels
Team
Posts
Members
Info

Utility to parse HTML fragments to HAST?

I've been using hastscript to quickly create HAST trees and it's great (experimental repo here), and I'm wondering: is there a quick way to create HAST nodes from HTML fragments? Any plans on the roadmap for a hast-util-from-html utility? I don't know if you can get the HAST out…

thumbsup
0
message-simple
12

Simplest way to HTML string > HTML ast > ast changes > HTML string?

Hello. I'm working on a site to help average Joe understand what's going on with corona virus, because all info is too technical or complex for average people. I'm trying to find an example for this pipeline, any help is highly appreciated!

thumbsup
0
message-simple
5

How to compile a custom hast node into HTML?

(editied) Let me clarify my question.. I have a correct mdast, and a correct hast (generated from https://github.com/Ir1d/remark-details) …

thumbsup
0
message-simple
3

Why hast has tagName&proporites but unist declaring same props as 'data' prop?

It is no rules which Node props may have custom syntax tree? Can i just name all node props & make Node inherit rules as i want, deploy at least 100 packages (one func per package for sure) to deal with my syntax, name it cust (custom syntax tree) and join unified family?

thumbsup
0
message-simple
1

Set title tag contet taken from the first h1 tag

What I'd like to achive is to set title tag contet taken from the first h1 tag. Already managed to find the first h1 in the hast and take its contet as string. Now the questions is how to insert html tag (particularly <title> or jsx component back to the hast ?

thumbsup
0
message-simple
4

After remark2rehype .. plugins are not working

I have tried multiple rehype plugins, but it seems none of them is working. One is https://github.com/rstacruz/rehype-decorate .. try to run the example, it's outputting only <h1>hello world</h1>. Another one is https://github.com/agentofuser/rehype-section .. also does not work…

thumbsup
0
message-simple
14

Using an external parser with rehype-react

Is it possible to use rehype-react without rehype-parser? I would like to use svg-parser (https://github.com/Rich-Harris/svg-parser), which also returns a HAST object. As I am only wanting to parse SVG files, rehype-parser doesn't seem the best fit. Thanks.

thumbsup
0
message-simple
9

Only select single element from html (by id)

Maybe I'm misusing unist-util-select.select here (if so please let me know what's the preferred way), but I'm trying to extract a single element from html by its id. If I do select('#foobar', tree) however, I get Error: Invalid selector: id. What would be the normal progression…

thumbsup
0
message-simple
1

Creating (?) a plugin for adding soft-hyphens (&shy;) according to a dictionary

I just learned about unified and I really like the approach. Regularly, I stumble upon the same problem: Long-words that do not properly break in the web. I tried to use css's hyphens: auto;, but this outsources the problem to the browser which some of them are doing a bad…

thumbsup
0
message-simple
2

Rehype-Formatter throwing error in test suite

Hi, i am not sure if this belongs here but I did not find a place for rehype. rehype-formatter. We are using rehype to format our html which is working fine. But when we are trying to write test cases for our code, rehype is throwing the following error.

thumbsup
0
message-simple
10