mirror of
https://github.com/ralsina/tartrazine.git
synced 2025-06-19 06:33:06 -03:00
feat: Support custom template for HTML standalone output
This commit is contained in:
27
README.md
27
README.md
@ -127,6 +127,33 @@ pico
|
||||
|
||||
Be careful not to build without any themes at all, nothing will work.
|
||||
|
||||
## Templates for standalone HTML output
|
||||
|
||||
If you are using the HTML formatter, you can pass a template to use for the output. The template is a string where the following placeholders will be replaced:
|
||||
|
||||
* `{{style_defs}}` will be replaced by the CSS styles needed for the theme
|
||||
* `{{code}}` will be replaced by the highlighted code
|
||||
|
||||
This is an example template that changes the padding around the code:
|
||||
|
||||
```jinja2
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
{{style_defs}}
|
||||
pre {
|
||||
padding: 1em;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
{{body}}
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
|
||||
## Contributing
|
||||
|
||||
1. Fork it (<https://github.com/ralsina/tartrazine/fork>)
|
||||
|
Reference in New Issue
Block a user