PrismJS/prism

Keep Markup: the markup is removed if it's the last element

Open

#1 618 ouverte le 18 nov. 2018

Voir sur GitHub
 (1 commentaire) (0 réactions) (0 assignés)JavaScript (1 296 forks)batch import
bughelp wantedplugins

Métriques du dépôt

Stars
 (11 488 stars)
Métriques de merge PR
 (Merge moyen 86j 15h) (12 PRs mergées en 30 j)

Description

I don't if this is intended or not but if the markup (in the exemple below <div class="keep"></div>") is the last element, the Keep Markup plugin will remove it:

<!DOCTYPE html>
<html>
  <head>
    <link href="prism.css" rel="stylesheet" />
    <style>
    .keep {
      height: 1rem;
      width: 1rem;
      background-color: red;
    }
    </style>
  </head>
  <body>
    <pre><code class="language-css"><div class="keep"></div>p { color: red }<div class="keep"></div></code></pre>
    <script src="prism.js"></script>
  </body>
</html>

And here's the result:

error

As you can see the first <div class="keep"></div> is preserved but the last is removed. If I add some content after the div then it's working as expected:

good

Guide contributeur