Some tools to format references in documentation
This is a small package I created to help me format references in my documentation. It uses pandoc to convert the references from bibtex to a format that can be used in markdown files.
For example, this input file along with the corresponding bibliography file can be used to generate this output file.
You can install the package via pip:
pip install docite
You can use the package from the command line as follows:
docite --inputfile <INPUTFILE> --outputfile <OUTPUTFILE> --bibfile <BIFILE>
or:
python -m docite.cli --inputfile <INPUTFILE> --outputfile <OUTPUTFILE> --bibfile <BIFILE>
You can also use the package from python as follows:
from docite import convert convert.convert_with_refs(inputfile, outputfile, bibfile)
My personal workflow is:
- I use Zotero to manage my references and then export them to a Better Bibtex file.
- I use the Citation Picker for Zotero extension within VSCode to add the references to my markdown files.
- I use docite to generate an output markdown file with the references formatted.
Here is a gif showing how I use the package:
By default, the package will use the IEEE citation style. You can change the citation style by using the --stylefile option, e.g., to change the citation style to APA you can use the following command:
docite --inputfile <INPUTFILE> --outputfile <OUTPUTFILE> --bibfile <BIFILE> --stylefile path/to/downloaded/apa.csl
You can find citation style language files in the citation-style-language repository.
This project uses pre-commit, please make sure to install it before making any changes:
pip install pre-commit cd docite pre-commit install
It is a good idea to update the hooks to the latest version:
pre-commit autoupdate
Don't forget to tell your contributors to also install and use pre-commit.
This project has been set up using PyScaffold 4.5. For details and usage information on PyScaffold see https://pyscaffold.org/.