Hi,

Attached are two TINYCHANGE patches that provide an alternative way of
displaying line numbers in generated HTML output.

The current approach hardcodes a span containing preformated text. It's
non-trivial to move this in the displayed output or adjust the formatting.
The content is also part of the selectable part of the page, so if you
copy/paste code from an ORG -> HTML file you get the line numbers as well.

The first patch just wraps each line of code in a <code> element. The
second patch extends this to include the line number of that element as a
special data- attribute. The value of this can be accessed in CSS to
display the line number, format it in interesting ways, etc, while keeping
it non-selectable, so that copy/pasting the code ignores the line numbers.

N

Attachment: 0001-ox-html.el-Wrap-each-line-of-a-source-block-in-a-cod.patch
Description: Binary data

Attachment: 0002-ox-html.el-Include-the-line-number-as-a-data-attribu.patch
Description: Binary data

Reply via email to