# Code span with leading newline

**URL:** <https://talk.commonmark.org/t/code-span-with-leading-newline/4546>\
**Category:** Uncategorized\
**Created:** [November 25, 2023, 9:48pm UTC](https://talk.commonmark.org/t/code-span-with-leading-newline/4546 "2023-11-25T21:48:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![notriddle](https://cdn.commonmark.org/user_avatar/talk.commonmark.org/notriddle/32/1237_2.png) [@notriddle](https://talk.commonmark.org/u/notriddle)\
**Post date:** [November 25, 2023, 9:48pm UTC](https://talk.commonmark.org/t/code-span-with-leading-newline/4546/1 "2023-11-25T21:48:09Z")

</div>

Consider the ASCII string: `60 0A 20 60`

```markdown
`
 `

```

I’m reading the CommonMark Spec, trying to understand what it calls for in this case.

> - First, [line endings](https://spec.commonmark.org/0.30/#line-ending) are converted to [spaces](https://spec.commonmark.org/0.30/#space).
> - If the resulting string both begins _and_ ends with a [space](https://spec.commonmark.org/0.30/#space) character, but does not consist entirely of [space](https://spec.commonmark.org/0.30/#space) characters, a single [space](https://spec.commonmark.org/0.30/#space) character is removed from the front and back. This allows you to include code that begins or ends with backtick characters, which must be separated by whitespace from the opening or closing backtick strings.

This sounds like it implies that it should convert the string to `60 20 20 60`, then, seeing that the string consists entirely of spaces, leave them alone.

However, [markdown-it](https://markdown-it.github.io/#md3=%7B%22source%22%3A%22%60%5Cn%20%60%5Cn%22%2C%22defaults%22%3A%7B%22html%22%3Afalse%2C%22xhtmlOut%22%3Afalse%2C%22breaks%22%3Afalse%2C%22langPrefix%22%3A%22language-%22%2C%22linkify%22%3Atrue%2C%22typographer%22%3Atrue%2C%22_highlight%22%3Atrue%2C%22_strict%22%3Afalse%2C%22_view%22%3A%22src%22%7D%7D) is the only implementation I know of that actually does this.

[commonmark-hs](https://pandoc.org/try/?params=%7B%22text%22%3A%22%5Bfirst%5Cn-%5Cnsecond%5D%3A+https%3A%2F%2Fexample.com%5Cn%5Cn%5Bfirst%5Cn-%5Cnsecond%5D%22%2C%22to%22%3A%22html5%22%2C%22from%22%3A%22commonmark%22%2C%22standalone%22%3Afalse%2C%22embed-resources%22%3Afalse%2C%22table-of-contents%22%3Afalse%2C%22number-sections%22%3Afalse%2C%22citeproc%22%3Afalse%2C%22html-math-method%22%3A%22plain%22%2C%22wrap%22%3A%22auto%22%2C%22highlight-style%22%3Anull%2C%22files%22%3A%7B%7D%2C%22template%22%3Anull%7D) [commonmark.js](https://spec.commonmark.org/dingus/?text=%60%0A%20%60%0A), Goldmark (Hugo), and [GitHub](https://gist.github.com/notriddle/21c8422c94e308e431a712d04c2f1e92) all write one space. Why?
