• Hi. Your plugin is great (i have just upgraded to latest version) but i miss one thing (or maybe i just simple do not know, how to do it) – i need to highlight a portion of the code, part of one line, not the full line. I need it to show, where exactly the user need to put his ID. I have found only highlighting the full text.

    And one more small question – is there any way, how can i limit maximum number of lines to show so if there will be more, the vertical bar would appear? I have noticed, that when i insert one line code, that there appear up/down arrows (unnecessary by the way). But with more lines, they are not there. I am solving it by max-height: 200px; for .EnlighterJSWrapper but maybe there is some more standard way

    https://www.ads-software.com/plugins/enlighter/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Andi Dittrich

    (@andi-dittrich)

    Hi thomask,

    it’s currently not possible to highlight a portion of code and it is difficult to implement, because the source-code is splitted into tokens and the boundaries may to match. maybe in a future release, but it requires deep modification of the EnlighterJS core.

    to set max-height and overflow: scroll is the recommended way to enable scrolling

    Thread Starter thomask

    (@thomask)

    thanks for response. I was wondering about some “hack” using e.g. nested shortcode. So that e.g. i would wrote

    <code>this is my code [highlight]and this what i want to highlight[/highlight] and the rest of code</code> – if this would work, it would not need any complex changes. Of course this option would have to be optionaly turned off for the rare cases, when someone wants a code with [highlight] in brackets.

    Plugin Author Andi Dittrich

    (@andi-dittrich)

    I’m sorry, but such “hack” wont work, because the new shortcode-processor does not process any shortcodes within an enlighter shortcode. the inner-content is “immutable” to avoid conflicts with other plugins, filters html-special-chars and disable the wpautop filter.
    on the other hand, the underlying EnlighterJS Highlighting Engine does not allow any HTML code. the complete content is passed to it and splitted into single language tokens. that’s the reason why its so difficult to implement it – it must be implemented as token-post-processing on-top of the language engine.

    for the next major Engine release (EnlighterJS v3) a “annotation” feature will be implemented which allows the selection of specific parts. this could be used in you case but it’s no possible to add this to the current version.

    currently, the only solution is to modify one of the language engine rulesets and add a static rule (add a new token type) which matches your special text.

    maybe you should look for another Highlighting Plugin or add the sourcecode as an image if its only needed in a single place.

    Thread Starter thomask

    (@thomask)

    thanks, i will stick with this as i like it ?? (and i have not found any other, that supports it)

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Highlight a part of a text?’ is closed to new replies.