radicallyopensecurity / pentext-docker

CI runners and toolchain to build and convert Pentext reports in Docker.
GNU General Public License v2.0
1 stars 3 forks source link

[feat] Syntax Highlighting #1

Closed gronke closed 6 months ago

gronke commented 6 months ago

Syntax Highlighting can be enabled with --highlight-syntax or HIGHLIGHT_SYNTAX=yes environment variable and is disabled by default to stay backwards compatible with existing projects.

Incorporates GPL-compliant source code from Cpython: https://github.com/python/cpython/blob/bfc57d43d8766120ba0c8f3f6d7b2ac681a81d8a/Lib/xml/etree/ElementTree.py#L1140-L1187

This modified indent method allows us to exclude <pre> elements from indentation. Otherwise preserved whitespace adds unnecessary left padding to code block elements within a PDF report.