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

Unhighlighted code blocks contain invalid trailing newlines #527

Closed
nicoburns opened this issue Jan 24, 2025 · 1 comment
Closed

Unhighlighted code blocks contain invalid trailing newlines #527

nicoburns opened this issue Jan 24, 2025 · 1 comment

Comments

@nicoburns
Copy link
Contributor

This is the same issue as #278, except that it still occurs for codeblocks that are not syntax highlighted.

The easiest way to reproduce this is to comment out the line plugins.render.codefence_syntax_highlighter = Some(&adapter); in the syntect example. Or alternatively run the following code:

use comrak::{markdown_to_html, Options};

fn main() {
    let input = concat!("```Rust\n", "fn main<'a>();\n", "```");
    let formatted = markdown_to_html(input, &Options::default());
    println!("{}", formatted);
}

this prints

<pre><code class="language-Rust">fn main&lt;'a&gt;();
</code></pre>

rather than

<pre><code class="language-Rust">fn main&lt;'a&gt;();</code></pre>
@kivikakk
Copy link
Owner

Per #528 (comment), this behaviour is required by the spec; #278 was a bit different in that it had a leading newline as well.

@kivikakk kivikakk closed this as not planned Won't fix, can't repro, duplicate, stale Jan 26, 2025
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 a pull request may close this issue.

2 participants