-
Notifications
You must be signed in to change notification settings - Fork 961
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
Newlines removed from code blocks when syntax highlighting and HTML minification both active #1300
Comments
The current implementation of HTML minification conflicts with syntax highlighting. See here: getzola/zola#1300
It looks like it works as expected on the |
I just compiled Zola from the head of the $ git clone git@github.com:getzola/zola.git
$ cd zola
$ git checkout next
$ cargo build
$ ./target/debug/zola init tester
Welcome to Zola!
Please answer a few questions to get started quickly.
Any choices made can be changed by modifying the `config.toml` file later.
> What is the URL of your site? (https://example.com):
> Do you want to enable Sass compilation? [Y/n]:
> Do you want to enable syntax highlighting? [y/N]: y
> Do you want to build a search index of the content? [y/N]:
Done! Your site was created in ./tester
Get started by moving into the directory and using the built-in server: `zola serve`
Visit https://www.getzola.org for the full documentation. I then modified <!doctype html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
{{ page.content|safe }}
</body>
</html> And finally added a content page at
Then when I ran $ curl http://127.0.0.1:1111/test
<!doctype html><html><head><meta charset=utf-8><body><pre style=background-color:#2b303b;>
<code class=language-rust data-lang=rust><span style=color:#b48ead;>fn </span><span style=color:#8fa1b3;>main</span><span style=color:#c0c5ce;>() { println!("</span><span style=color:#a3be8c;>Hello, world!</span><span style=color:#c0c5ce;>"); } </span></code></pre><script src=/livereload.js?port=1024&mindelay=10></script> |
You're right, I don't know how I tested it before. |
Hi, just wanted to confirm that this is indeed fixed and working in the |
Fixes regression introduced in c820dce. The minify_html option wasn't implemented in the Zola version in Nixpkgs 20.09. When I bumped the version to 21.05, it took affect and messed with linebreaks in the `<pre>` tag. Overrode Zola to achieve the correct results. See getzola/zola#1300.
Using Zola version 0.13.0, when
minify_html = true
andmarkdown.highlight_code = true
inconfig.toml
, newlines are removed from Markdown code blocks.Expected behaviour
Newlines should be preserved within Markdown code blocks.
Current behaviour
When
minify_html = true
andmarkdown.highlight_code = true
, this Markdown code block:Is converted into this HTML:
When either (or both)
minify_html
ormarkdown.highlight_code
arefalse
, newlines are preserved, e.g.The text was updated successfully, but these errors were encountered: