Skip to content

PHP Code Block extra line containing '{1}' #42

@urbans0ft

Description

@urbans0ft

When using php as language and an html element contains a class attribute the result contains an extra line containing only: {1}

To Reproduce
Minimal bug example:

<head>
  <!-- HighlightJs -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css" />
  <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>

  <!-- HighlightJs with line numbering include *after* HighlighJs -->
  <script src="https://cdnjs.cloudflare.com/ajax/libs/highlightjs-line-numbers.js/2.3.0/highlightjs-line-numbers.min.js"></script>

  <script>
    hljs.initHighlightingOnLoad();
    hljs.initLineNumbersOnLoad();
  </script>
</head>
<body>
  <pre><code class="php language-php">&lt;div class="arbitrary"&gt;
&lt;/div&gt;
</code></pre>
</body>

Result

1 | <div class="arbitrary">
2 | </div>
3 | {1}

Expected behavior

1 | <div class="arbitrary">
2 | </div>

Additional context
I've boiled it done to the class="arbitrary" attribute. If you omit it everything is fine. You'll find the minimal example at JSFiddle as well.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions