-
|
Hello! thank you for micromark,i love it so much !!! 🎉 but i have some problems and i have no better idea to elegant approach to solve its. Partial HTML Tag Parser.In some cases, i hope to recognize part of the html tag. For example, in some AI scenarios, it is expected to allow a URL Recognize.Like End NoteI like micromark so much and I look forward to bringing it to our company and letting more people know about it. In addition, I look forward to being a future contributor to the micromark ecosystem ~ 🎉🎉🎉🎉 From an Oriental friend with poor English |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 10 replies
-
|
Hi there!
It should work, I have no clue what you mean? Links are supported in micromark. |
Beta Was this translation helpful? Give feedback.
-
|
I found some differences between remark and micromark when I tried to use remark. Q: The html string is gone.import { unified } from 'unified';
import remarkParse from 'remark-parse';
import remarkRehype from 'remark-rehype';
import rehypeStringify from 'rehype-stringify';
import {micromark} from 'micromark';
const markdown = `# Difference.
<p style="color: red;">dom</p>`;
const result = unified()
.use(remarkParse)
.use(remarkRehype)
.use(rehypeStringify)
.process(markdown)
.then((file) => {
console.log('\nremark:', String(file));
});
console.log('\nmicromark:', micromark(markdown, 'utf-8'));micromark: <h1>Difference.</h1>
<p style="color: red;">dom</p>
remark: <h1>Difference.</h1>micromark is right, but remark is confusing. I tried to open the allowDangarousHtml,as well as trying to use a lot of plugins that are not supported. What should be done in remark? 😭 |
Beta Was this translation helpful? Give feedback.
micromark is indeed lower level. But you want some higher level things: the remark/rehype level is where all the extensions are!
For your first Q, which is allowing/disallowing some HTML, you can:
a) move up a level, https://github.com/syntax-tree/mdast-util-from-markdown, https://github.com/syntax-tree/mdast-util-to-hast, https://github.com/syntax-tree/hast-util-raw, https://github.com/syntax-tree/hast-util-sanitize
b) move up to plugins, use unified + remark + rehype, specifically https://github.com/rehypejs/rehype-sanitize
c) use a single tool that does all that: micromark + some HTML sanitizer of your choosing
For the second Q, what you call “autolink”: that behavior is not “standard”…