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

Whitespace is removed in code #85

Open
JamesDConley opened this issue Mar 2, 2023 · 3 comments
Open

Whitespace is removed in code #85

JamesDConley opened this issue Mar 2, 2023 · 3 comments

Comments

@JamesDConley
Copy link

JamesDConley commented Mar 2, 2023

When converting html with <code> blocks the whitespace ends up with a maximum of one space. This unfortunately means anything with python in codeblocks can't be converted :(

@kelibird
Copy link

kelibird commented Mar 9, 2023

image

@Meathelix1
Copy link

image

Thanks! Was wondering why my code was doing this.

@chrispy-snps
Copy link
Collaborator

I don't think this is a bug. <code> is an inline HTML element per the specification, and thus it does not preserve whitespace. If you render

<code>line1
line2
line3</code>

in a browser, all three words will be on a single line.

You need to enclose your code in a <pre> block, which is whitespace-preserved per the specification.

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

No branches or pull requests

4 participants