EnlighterJS / Plugin.WordPress

:package: Official WordPress Plugin of EnlighterJS
http://wordpress.org/plugins/enlighter/
GNU General Public License v2.0
118 stars 17 forks source link

Using line numbers with BBPress #208

Closed ajtruckle closed 4 years ago

ajtruckle commented 4 years ago

I am using the [generic] code formatting option because the code I am showing is a custom language. It looks quite nice "as is":

Sample-BBPress

But I wanted to try and display line numbers. So I adjusted the shortcode like this:

[generic linenumbers="true"]

But I could not get it to work. I thought I had followed the documentation right?

AndiDittrich commented 4 years ago

does the global linenumber setting work ? if not please check the sourcecode - in case ol wrapper is used your theme is overriding the line number styles

ajtruckle commented 4 years ago

I don't quite understand this. When I view the page source with IE, there is this first sectionL

Snap1

Then, there is a second element with the ol elements you referred too:

Snap2

And the code also appears again inside that second block as a lump.

So I don't know how to proceed.

ajtruckle commented 4 years ago

If I use this styling:

list-style-position: inside;

Then it seems to work::

Snap3

I stumbled on that from this StackOverflow question. So is there a place in your plugin that I can add this custom styling, or must we put something into my child theme Additional CSS area?

ajtruckle commented 4 years ago

Could it just be the width of the ol li objects or something? For example if I change it to Godzilla:

Snap4

When I use inside it looks like your samples:

Snap5

ajtruckle commented 4 years ago

If I use this additional CSS it will work:

#bbpress-forums div.bbp-reply-content ol li
{
    list-style-position: inside;
}

But my concern is that the above will affect standard ol li objects and not limit it to just the EnlighterJS elements.

ajtruckle commented 4 years ago

I used this:

#bbpress-forums div.bbp-reply-content ol li.odd,
#bbpress-forums div.bbp-reply-content ol li.even
{
    list-style-position: inside;
}

Please tell me if it was wrong. It seems the bbpress-forums styling is overriding the .EnlighterJS styling in the CSS hierarchy. The above would fail with the .bbp-topic-content elements too.

This must have come up before for bbPress users. What is the safest way to get this styling correct just for the .EnlighterJS ol li elements?

AndiDittrich commented 4 years ago
ol.EnlighterJS > li, ul.EnlighterJS > li{
list-style-position: inside !important;
}
ajtruckle commented 4 years ago

Thank you. That looks like it is working for me and line numbers are showing.