Support » Plugin: WP-GeSHi-Highlight — rock-solid syntax highlighting for 259 languages » Empty line through line if line numbering is enabled in Firefox

  • When using numbered lines, an empty line is added through the line in the Firefox.
    Example from plugin page on your site: https://i.imgur.com/S4Msp9V.png

    [Suggestion]
    Noticed in your plugin on line 307:
    $geshi->set_header_type(GESHI_HEADER_PRE_VALID);
    It would be great to add special attribute to the <pre> tag, for example <pre header="div">, which would set the type of code container to GESHI_HEADER_DIV.
    In this case, the code is copied normally.

    • This topic was modified 10 months, 1 week ago by Vladislav.
    • This topic was modified 10 months, 1 week ago by Vladislav.
    • This topic was modified 10 months, 1 week ago by Vladislav.
    • This topic was modified 10 months, 1 week ago by Vladislav.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Jan-Philip Gehrcke

    (@jgehrcke)

    Thanks, Vladislav.

    > When using numbered lines, an empty line is added through the line in the Firefox

    Upon copy/pasting, right?

    That is, when using line numbers, you see unexpected copy/pasting behavior.

    Choosing a method to build up the HTML when using line numbers is a difficult choice, see the documentation here (Vladislav, I suspect you have read this part, but I still put it here for reference): http://qbnz.com/highlighter/geshi-doc.html#the-code-container. There does not seem to be one method that does the right thing from all perspectives.

    The solution that you propose, exposing this choice to the user of WP-GeSHi-Highlight, is definitely a possible solution.

    Can’t make promises at this point, though.

    Generally, it might be that a better approach is to have pure CSS-based line numbering, not making use of GeSHi’s $geshi->enable_line_numbers() at all. But that would be a breaking change …

    Yes, the usual copying of the code through ctrl+c or the context menu and pasting into a text editor.

    You are right, there is no guaranteed solution. I now checked it in IE11 and this does not work.

    Also I noticed another parameter GESHI_HEADER_PRE_TABLE, I do not know why I did not test it before, but in IE11, Firefox 72.0.2, Chrome 79 and Edge it works fine. Of course, it may not work in some older versions of browsers.

    About specially “header” attribute about which I wrote. Instead, the plugin may allow the user to modify the $geshi object through a filter in functions.php where user can set type of code container.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Empty line through line if line numbering is enabled in Firefox’ is closed to new replies.