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.
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
demo/line-numbers.php