# Spaces and newlines in tests

**URL:** <https://talk.commonmark.org/t/spaces-and-newlines-in-tests/137>\
**Category:** Spec\
**Created:** [September 3, 2014, 11:10pm UTC](https://talk.commonmark.org/t/spaces-and-newlines-in-tests/137 "2014-09-03T23:10:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pragdave](https://talk.commonmark.org/user_avatar/talk.commonmark.org/pragdave/32/90_2.png) [@pragdave](https://talk.commonmark.org/u/pragdave)\
**Post date:** [September 3, 2014, 11:10pm UTC](https://talk.commonmark.org/t/spaces-and-newlines-in-tests/137/1 "2014-09-03T23:10:05Z")

</div>

A number of the tests in `spec.txt` assume certain layout conventions in the HTML. Many of these have no effect on the rendered result, but they do cause my tests to fail. For example:

```auto
`code  
span`
     code: result == @html
     lhs: "<p>`code \nspan`</p>\n"
     rhs: "<p><code>code span</code></p>\n"

```

My code adds a `\n`, while the test does not.

Given that inline elements are by their nature intended to create inline content, and that it would be abusing the markup to render then using `display: block`, is my markup incorrect to add the \n? If not, should the tests be more permissive?

Thanks for this work. It’s much appreciated.

Dave

---

<div class="post-metadata">

**Author:** ![jgm](https://talk.commonmark.org/user_avatar/talk.commonmark.org/jgm/32/1360_2.png) [@jgm](https://talk.commonmark.org/u/jgm)\
**Post date:** [September 3, 2014, 11:36pm UTC](https://talk.commonmark.org/t/spaces-and-newlines-in-tests/137/2 "2014-09-03T23:36:02Z")

</div>

+++ pragdave [Sep 03 14 23:20]:

> A number of the tests in spec.txt assume certain layout conventions in  
> the HTML. Many of these have no effect on the rendered result, but they  
> do cause my tests to fail.
> 
> Given that inline elements are by their nature intended to create  
> inline content, and that it would be abusing the markup to render then  
> using display: block, is my markup incorrect to add the \n? If not,  
> should the tests be more permissive?

The spec explicitly says that consecutive whitespace inside a code span  
is collapsed to a single space. You might quibble with that decision.

---

<div class="post-metadata">

**Author:** ![pragdave](https://talk.commonmark.org/user_avatar/talk.commonmark.org/pragdave/32/90_2.png) [@pragdave](https://talk.commonmark.org/u/pragdave)\
**Post date:** [September 4, 2014, 2:14am UTC](https://talk.commonmark.org/t/spaces-and-newlines-in-tests/137/3 "2014-09-04T02:14:57Z")

</div>

I guess I am “quibbling,” in that I don’t believe it is beneficial for the spec to include rules that have no effect on the visible output. It is difficult to implement a markdown parser—why make it harder with additional specifications that make no practical difference?

Cheers

Dave

---

<div class="post-metadata">

**Author:** ![poke](https://talk.commonmark.org/user_avatar/talk.commonmark.org/poke/32/39_2.png) [@poke](https://talk.commonmark.org/u/poke)\
**Post date:** [September 4, 2014, 2:32am UTC](https://talk.commonmark.org/t/spaces-and-newlines-in-tests/137/4 "2014-09-04T02:32:00Z")

</div>

I’d be interested in a reasoning for this whitespace eating behavior too, especially since there are some similar situations in the spec where it does not happen (e.g. examples 122/124, 249–252, 343).
