Skip to content

unclean work with class names (adding unneeded spaces during DOM manipulations) #2383

@galaxy4public

Description

@galaxy4public

Information:

  • Prism version: latest (from the master branch)
  • Plugins: none
  • Environment: Browser

Description

The way how PrismJS works with class attributes for languages (See: https://github.com/PrismJS/prism/blob/master/components/prism-core.js#L260) is unclean since it introduces unnecessary leading white space, e.g. if the original HTML was:

<pre class="highlight">
  <code class="language-css">
     some code
  </code>
</pre>

After PrismJS.highlightAll() it would become (there are two spaces in front of language-XXX instead of one:

<pre class="highlight  language-css">
  <code class="  language-css">
     some code
  </code>
</pre>

It is a minor, mostly cosmetic issue, but it would be nice if PrismJS did the right thing and introduced the leading white space only if there is something in the class line already (and definitely use one space in that case :) )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions