scrivo / highlight.php

A port of highlight.js by Ivan Sagalaev to PHP
BSD 3-Clause "New" or "Revised" License
695 stars 45 forks source link

Add new utilities based namespace #43

Closed allejo closed 5 years ago

allejo commented 5 years ago

Time for me to go back on what I originally said and introduce official support for line numbers; sorta.

42 brought to my attention that generated elements that span multiple lines single <span>s that are handled through line breaks. This means my original split on \R in #28 and #19 would break highlighting because it'd split up the generated <span>s.

I stand by the decision that returning highlighted code as an array does not belong in our core implementation. However, I do see the benefit of providing this functionality so here's a compromise:

This PR introduces a new namespace, HighlightUtilities, which will be dedicated to housing helpful utilities. The first utility will be one that accepts the highlighted code and split it into an array of non-broken HTML strings.

Fixes #42

Left to do