Skip to content

Why pad inlineCode's value with spaces? #46

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

You must be logged in to vote

This behavior is needed to roundtrip the value (see the comment above it): https://spec.commonmark.org/0.30/#code-span.
The padding has to be done on both sides: it doesn’t work if it’s only on one side, then it changes the code.

As you can see from your example, they are equivalent: the spaces around it are dropped.

See some example: https://spec.commonmark.org/dingus/?text=1.%20%60%20%60%20one%20space%20(persists)%0A1.%20%60%20%20%20%20%60%20four%20spaces%20(persists)%0A1.%20%60a%20%60%20final%20space%20(persists)%0A1.%20%60%20a%60%20initial%20space%20(persists)%0A1.%20%60%20a%20%60%20initial%20and%20final%20space%20(dropped)%0A1.%20%60%60%20%60a%60%20%60%60%20spaces%20around%20ticks%20…

Replies: 1 comment 8 replies

Comment options

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

@wooorm
Comment options

@wooorm
Comment options

@vvenv
Comment options

@wooorm
Comment options

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