Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always suffix indented code block with a newline #799

Merged
merged 1 commit into from Jul 15, 2021

Conversation

hukkin
Copy link
Contributor

@hukkin hukkin commented Jul 12, 2021

Currently

    codeblock\n

(where \n represents a trailing newline) renders differently to

    codeblock

(no trailing newline).

The former renders to

<pre><code>codeblock
</code></pre>

and the latter to

<pre><code>codeblock</code></pre>

This PR makes the two examples render to the same HTML by always adding a trailing newline to code block content.

The spec is not overly clear about this corner case, but this PR makes

@rlidwka
Copy link
Member

rlidwka commented Jul 15, 2021

Merged, thanks!

Is code block the only place where the absense of trailing newline in original input matters?

@hukkin
Copy link
Contributor Author

hukkin commented Jul 15, 2021

Is code block the only place where the absense of trailing newline in original input matters?

This I don't have an answer to right now, I haven't tested. I found this issue while fuzzing mdformat and if there are other similar issues with other syntax then the fuzzer should find them when I have the time to get back into it.

@hukkin hukkin deleted the fix-no-codeblock-end-newline branch July 15, 2021 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants