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 23 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
3 replies
@gschlager
Comment options

@wooorm
Comment options

@wooorm
Comment options

Answer selected by ChristianMurphy
Comment options

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

@danburzo
Comment options

@thepont
Comment options

@wooorm
Comment options

@danburzo
Comment options

Comment options

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

@abelrasheed
Comment options

@lakbychance
Comment options

@wooorm
Comment options

@wooorm
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
8 participants