Skip to content

mdast-util-from-markdown - leading and trailing whitespace inside "strong" or "italic" nodes #60

Answered by wooorm
gschlager asked this question in Q&A
Discussion options

You must be logged in to vote

Hey again @gschlager! Sooo, it took me hours and hours of thinking but I managed to reproduce your AST in markdown 😅

foo** this is bold **bar

->
foo this is bold bar

Pretty doubtful that anyone would ever write that though. But even before I figured it out I already become more understanding of the use cases you mention, where folks are working on the ASTs and injecting punctuation/whitespace/whatever in text or adding/removing emphasis nodes.

We already use character references in a couple places. When things can be input:

 this 

->

<p> this </p>

…we try and output it too:

import {toMarkdown} from 'mdast-util-to-markdown'

/** @type {import('mdast').Root} */

Replies: 4 comments 17 replies

Comment options

You must be logged in to vote
7 replies
@wooorm
Comment options

@gschlager
Comment options

@wooorm
Comment options

@gschlager
Comment options

@wooorm
Comment options

Comment options

You must be logged in to vote
2 replies
@gschlager
Comment options

@wooorm
Comment options

Answer selected by ChristianMurphy
Comment options

You must be logged in to vote
6 replies
@bakkerjoeri
Comment options

@wooorm
Comment options

@bakkerjoeri
Comment options

@danburzo
Comment options

@thepont
Comment options

Comment options

You must be logged in to vote
2 replies
@wooorm
Comment options

@abelrasheed
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
7 participants