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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normalization should not change whitespace within <pre> and <code> blocks #18

Open
vassudanagunta opened this issue Jan 19, 2023 · 2 comments

Comments

@vassudanagunta
Copy link

(each observed flaw, all related, is marked with 馃毄)

馃毄 Normalize tries to make pretty, indented HTML, but in so doing messes up the whitespace of <pre> blocks which should never be touched:

normalized

If Normalize is unchecked, you can see the untouched HTML output of the various Markdown parsers.

馃毄 Note how the preview rendering uses the normalized version. Even if Normalize had no bugs, it would be best if the preview displayed the actual HTML shown above it.

non-normalized

CommonMark Dingus just for comparison:

block dingus


馃毄 The same problem occurs for non-pre <code> bocks used for inline code:

inline normalized

Normalize is unchecked shows the correct HTML, 馃毄 but as before the preview rendering uses the faulty normalized version:

inline non-normalized

CommonMark Dingus for comparison:

inline dingus

@vassudanagunta
Copy link
Author

I looked into fixing it myself, but it traces to the NUglify library and I'm not a C# coder. I'll report a parallel issue there.

@vassudanagunta
Copy link
Author

BTW, I'm the author of htmlnorm, a Javascript HTML normalizer. It emphasizes safety / semantic fidelity, in case you want to try doing this on the client side, paying particular attention to HTML5 spec and the whitespace rules it imposes on browser interpretation of HTML.

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

1 participant