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

Don't append trailing newline when parsing markdown code blocks #202

Closed
thislooksfun opened this issue Feb 6, 2021 · 4 comments · Fixed by #203 or #204
Closed

Don't append trailing newline when parsing markdown code blocks #202

thislooksfun opened this issue Feb 6, 2021 · 4 comments · Fixed by #203 or #204
Labels
bug Something isn't working

Comments

@thislooksfun
Copy link

thislooksfun commented Feb 6, 2021

Every other code block formatter (tested with ts, js, and html) leaves the fenced code blocks with no trailing newlines, but this one appends a trailing newline, which is therefore out of place and distracting. It would be great if this could leave 0 trailing newlines in these fenced blocks.

EDIT: namely, remove line 20 of test/printer/samples/markdown.md.

thislooksfun added a commit to thislooksfun/svelte-repo-card that referenced this issue Feb 7, 2021
This is pending sveltejs/prettier-plugin-svelte#202 because
currently it wants to add a newline to the end of the code block,
which is really annoying.
@dummdidumm dummdidumm added the bug Something isn't working label Feb 8, 2021
dummdidumm pushed a commit to dummdidumm/prettier-plugin-svelte that referenced this issue Feb 8, 2021
Prettier's markdown parser tries to strip the last hardline of the embedded docs, but fails to do so in our case because it does not recurse into concat parts -> we need to strip it ourselves.
Fixes sveltejs#202
dummdidumm added a commit that referenced this issue Feb 8, 2021
Prettier's markdown parser tries to strip the last hardline of the embedded docs, but fails to do so in our case because it does not recurse into concat parts -> we need to strip it ourselves.
Fixes #202
@thislooksfun
Copy link
Author

thislooksfun commented Feb 8, 2021

@dummdidumm Thanks for the quick fix! Unfortunately it doesn't seem to be working in the wild (https://github.com/thislooksfun/svelte-repo-card @ README.md#73-81). Any ideas why it's not working for me?

EDIT: Live example here

dummdidumm pushed a commit to dummdidumm/prettier-plugin-svelte that referenced this issue Feb 10, 2021
There were situations where the trim of the last line was not working.
sveltejs#202
dummdidumm added a commit that referenced this issue Feb 10, 2021
There were situations where the trim of the last line was not working.
#202
@dummdidumm
Copy link
Member

Thanks for the update, there was a situation the test did not catch, new release pending.

@dummdidumm
Copy link
Member

Released

@thislooksfun
Copy link
Author

That worked beautifully, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants