Pandoc filter to add attributes to code blocks based on its class
Project description
Pandoc filter to add attributes to code blocks based on its class.
Installation
First install python and python-pip.
Then use pip to install:
pip3 install --user pandoc-code-attribute
Usage
Example
This pandoc filter will add attributes to code blocks based on its class.
For example, it can be very useful to use different styles for different language in listings :
--- header-includes: | \usepackage{listings} \usepackage[usenames,dvipsnames]{color} \lstset{ % General settings numbers=left, numberstyle=\tiny } \lstdefinestyle{cpp}{ % Only for C++ keywordstyle=\color{Green} } \lstdefinestyle{python}{ % Only for Python keywordstyle=\color{Magenta} } --- C++: ```cpp int main(int argc, char *argv[]) { return 0; } ``` Python: ```python def main(): print('Hello') if __name__ == '__main__': main() ```
Then compile the example (--listings is needed only for this example):
pandoc input.md --filter pandoc-code-attribute --listings -o output.pdf
Results:
Command
In general, to use this filter, just add this filter to pandoc command:
pandoc input.md --filter pandoc-code-attribute -o output.pdf
License
MIT 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
Close
Hashes for pandoc-code-attribute-0.1.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 112af99a90405e1def4b673024f1fb9ec24268182cc8b73765ea985e5098afd7 |
|
MD5 | 6364e0e798c83e0b3ef4799d590a358d |
|
BLAKE2b-256 | 1dba5feb7960197df1b6c5b14dfb597b219c32740720301683879d8dc107dcf0 |
Close
Hashes for pandoc_code_attribute-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 022a222ac2f3a030d8e8487718f4d6732df1ecf038aafa23b87095959c081bf0 |
|
MD5 | c88aefa9d5aae8c50c684352ef95561d |
|
BLAKE2b-256 | 7cca91bbfd091590762d54ab2120d2d3ca61af54f26195705174246f2bd01f58 |