[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] PATCHES: Wrap code in <code>, add an attribute for line number value

From: Nik Clayton
Subject: [O] PATCHES: Wrap code in <code>, add an attribute for line number value
Date: Tue, 4 Jun 2019 15:56:25 +0200


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.


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

[Prev in Thread] Current Thread [Next in Thread]