Provides previews with syntax highlight for multiple formats
Project description
ckanext-pygments
This extension provides a preview with syntax highlight for multiple resources formats
TODO
- try to implement cache for preview to recalculate only styles. The structure could be pretty big so it must be taken into account.
- this solves problem with big resources and remote resources
- we must invalidate the cache on resources update/delete
- rewrite preview initialization with ajax to load page faster
- if caching does not fit us, think about load more button and ajax approach
- update doc to make it beautiful
Config settings
Supported config options:
-
ckanext.pygments.supported_formats
(optional, default:sql html xhtml htm xslt py pyw pyi jy sage sc rs rs.in rst rest md markdown xml xsl rss xslt xsd wsdl wsf json jsonld yaml yml dtd php inc rdf ttl js
). Specify the list of supported formats. -
ckanext.pygments.max_size
(optional, default:1048576
). Specify how many bytes we are going to render from file. Default to 1MB. Set to-1
if you want to disable a limit. This can cause the page to load very slowly. -
ckanext.pygments.include_htmx_asset
(optional, default:True
). Include HTMX asset in the page. Set toFalse
if you want to include it yourself or another extension already includes it. -
ckanext.pygments.default_theme
(optional, default:default
). Specify the default theme to use.
Tests
To run the tests, do:
pytest --ckan-ini=test.ini
License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file ckanext_pygments-1.1.0.tar.gz
.
File metadata
- Download URL: ckanext_pygments-1.1.0.tar.gz
- Upload date:
- Size: 37.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c5bec816caeaf924d3f799c21a09dd5829b01494eed6736fb50ea9fbda7f068 |
|
MD5 | d698cd3dad8144b4903d37a0bb302eb9 |
|
BLAKE2b-256 | a0266c3e7f251b8a619fbe1c07df5d59337dd13c39679171ccd7a64a4239239c |
File details
Details for the file ckanext_pygments-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: ckanext_pygments-1.1.0-py3-none-any.whl
- Upload date:
- Size: 39.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65b1d8763768e108deddd1f37a449024db0cbc0824e442102ff45d3b2632b8f9 |
|
MD5 | 5c70ddc834a333813eb05f4b4e9c7d66 |
|
BLAKE2b-256 | 1b8e32ebf21ecee8b539a00e674c2f76351334674b23d5396d31c7d11f86406e |