asciidoctor / asciidoctor-stylesheet-factory

!DEPRECATED! This was the utility project for producing the default stylesheet for the HTML converter in Asciidoctor. The source of the default stylesheet now lives in the main Asciidoctor repository.
Other
175 stars 87 forks source link

Modify code selector to accommodate Prettify #32

Closed stephenhay closed 5 years ago

stephenhay commented 8 years ago

The prettify source highlighter wraps the <code> element in an ordered list. This causes the lines to be decorated in the same way as inline monospaced text, which looks ugly when using the default stylesheet. Add special styles for prettify that prevent the nested <code> element from being styled.

We currently use *:not(pre)>code in the default stylesheet to style code inside prose. However, prettify breaks this assumption by putting an element (several) between the pre and code (unlike all the other syntax highlighters).

This fix is fairly safe, accommodates the above, and as opposed to using classes, any necessary refactoring in the future will only involve changing this selector as opposed to changes in both markup and CSS.

mojavelinux commented 5 years ago

I updated the selector as described in https://github.com/asciidoctor/asciidoctor/issues/640#issuecomment-453966684. I also added some additional styles to beautify the source blocks highlighted with prettify when linenums are enabled.

Merged as 483a57bae22ae8173ed89220c4455e866532c179. Thanks!