question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Extra empty line at the start of the code block

See original GitHub issue

Looks like prism reads the newline after <pre><code> and highlights it. Any way to disable that? In normal usage, we have a newline between <pre><code> and the code, and we probably don’t want to display it:

<pre><code class="language-javascript">
console.log('Hello world');
</code></pre>

The output starts with that empty line:

image

Of course, I could write

<pre><code class="language-javascript">console.log('Hello world');
</code></pre>

but that’s ugly in the source.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:27 (23 by maintainers)

github_iconTop GitHub Comments

1reaction
Golmotecommented, Aug 17, 2015

The removal of the initial line feed has been moved from core to a plugin: http://prismjs.com/plugins/remove-initial-line-feed/

0reactions
omundycommented, Nov 4, 2021

This is now located in the normalize whitespace plugin https://prismjs.com/plugins/normalize-whitespace/

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I eliminate the empty line in code blocks rendered by ...
Basically, the whitespace inside <pre> is not trimmed, and be treated as a newline in the rendered page (you can use firebug extension...
Read more >
How do you use blank lines in your code?
Blank lines are for opening sections of the code to work on, you have a couple hotkeys in your editor to take you...
Read more >
Copy paste in code block double the empty lines
Hello, When I copy code from an editor (Notepad+++, PyCharm etc.) and paste it into an Evernote code block, all empty lines are...
Read more >
Editor creates extraneous newlines when formatting blocks - Jira
When using the Rich Text Editor Visual mode, editing block of text into a format (e.g.: Code), it will add an extra newline....
Read more >
How to display multiple blank lines in Markdown
It fools the rendering code into adding a visually empty <p> </p> tag giving you an extra empty line. You can add as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found