mkdocs-bibtex


Namemkdocs-bibtex JSON
Version 2.15.0 PyPI version JSON
download
home_pagehttps://github.com/shyamd/mkdocs-bibtex/
SummaryAn MkDocs plugin that enables managing citations with BibTex
upload_time2024-04-04 14:33:31
maintainerNone
docs_urlNone
authorShyam Dwaraknath
requires_python>=3.6
licenseBSD-3-Clause-LBNL
keywords mkdocs python markdown bibtex
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            [![testing](https://github.com/shyamd/mkdocs-bibtex/workflows/testing/badge.svg)](https://github.com/shyamd/mkdocs-bibtex/actions?query=workflow%3Atesting)
[![codecov](https://codecov.io/gh/shyamd/mkdocs-bibtex/branch/main/graph/badge.svg)](https://codecov.io/gh/shyamd/mkdocs-bibtex)
[![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/shyamd/mkdocs-bibtex.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/shyamd/mkdocs-bibtex/context:python)

# mkdocs-bibtex

A [MkDocs](https://www.mkdocs.org/) plugin for citation management using bibtex.

## Setup

Install the plugin using pip:

```
pip install mkdocs-bibtex
```
> *Note:* This plugin requires pandoc to be installed on your system.<br>
> If you're having trouble with pandoc, try installing the conda-forge version of pypandoc: `conda install -c conda-forge pypandoc` which will install a version with built in pandoc binaries


Next, add the following lines to your `mkdocs.yml`:

```yml
plugins:
  - search
  - bibtex:
      bib_file: "refs.bib"
markdown_extensions:
  - footnotes
```

The footnotes extension is how citations are linked for now.

> If you have no `plugins` entry in your config file yet, you'll likely also want to add the `search` plugin. MkDocs enables it by default if there is no `plugins` entry set.

## Options

- `bib_file` - The path or url to a single bibtex file. Path can either be absolute or relative to `mkdocs.yml`. Example URL: `https://api.zotero.org/*/items?format=bibtex`
- `bib_dir` - Directory for bibtex files to load, same as above for path resolution
- `bib_command` - The syntax to render your bibliography, defaults to `\bibliography`
- `bib_by_default` - Automatically append the `bib_command` at the end of every markdown document, defaults to `true`
- `full_bib_command` - The syntax to render your entire bibliography, defaults to `\full_bibliography`
- `csl_file` - The path or url to a bibtex CSL file, specifying your citation format. Defaults to `None`, which renders in a plain format. A registry of citation styles can be found here: https://github.com/citation-style-language/styles
- `cite_inline` - Whether or not to render citations inline, requires `csl_file` to be specified. Defaults to `False`.

## Usage

In your markdown files:

1. Add your citations as you would if you used pandoc, IE: `[@first_cite;@second_cite]`
2. Add `\bibliography`, or the value of `bib_command`, to the doc you want your references rendered (if `bib_by_default` is set to true this is automatically applied for every page).
3. (Optional) Add `\full_bibliography`, or the value of `full_bib_command`, to where you want the full bibliography rendered. *Note*: This is currently not working properly, since this plugin can't dictate the order in which files are processed. The best way to ensure the file with the full bibliography gets processed last is to use numbers in front of file/folder names to enforce the order of processing, IE: `01_my_first_file.md`
4. (Optional) Configure the `csl_file` option to dictate the citation text formatting.

## Debugging

You may wish to use the verbose flag in mkdocs (`-v`) to log debug messages. You should see something like this

```bash
(...)
DEBUG   -  Parsing bibtex file 'docs/bib/papers.bib'...
INFO    -  SUCCESS Parsing bibtex file 'docs/bib/papers.bib'
DEBUG   -  Downloading CSL file from URL https://raw.githubusercontent.com/citation-style-language/styles/master/apa-6th-edition.csl to temporary file...
INFO    -  CSL file downladed from URL https://raw.githubusercontent.com/citation-style-language/styles/master/apa-6th-edition.csl to temporary file (<tempfile._TemporaryFileWrapper object at 0x00000203E4F2F650>)
(...)
DEBUG   -  Reading: publications.md
DEBUG   -  Running 2 `page_markdown` events
DEBUG   -  Formatting all bib entries...
DEBUG   -  --Converting bibtex entry 'foo2019' with CSL file 'docs/bib/apa_verbose.csl' using pandoc>=2.11
DEBUG   -  --SUCCESS Converting bibtex entry 'foo2019' with CSL file 'docs/bib/apa_verbose.csl' using pandoc>=2.11
DEBUG   -  --Converting bibtex entry 'bar2024' with CSL file 'docs/bib/apa_verbose.csl' using pandoc>=2.11
DEBUG   -  --SUCCESS Converting bibtex entry 'bar2024' with CSL file 'docs/bib/apa_verbose.csl' using pandoc>=2.11
INFO    -  SUCCESS Formatting all bib entries
DEBUG   -  Replacing citation keys with the generated ones...
DEBUG   -  --Rendering citation inline for '[@foo2019]'...
DEBUG   -  ----Converting pandoc citation key '[@foo2019]' with CSL file 'docs/bib/apa_verbose.csl' and Bibliography file '(...)/tmpzt7t8p0y/temp.bib'...
DEBUG   -  ----SUCCESS Converting pandoc citation key '[@foo2019]' with CSL file 'docs/bib/apa_verbose.csl' and Bibliography file '(...)/tmpzt7t8p0y/temp.bib'
DEBUG   -  --SUCCESS Rendering citation inline for '[@foo2019]'
DEBUG   -  --Rendering citation inline for '[@bar2024]'...
DEBUG   -  ----Converting pandoc citation key '[@bar2024]' with CSL file 'docs/bib/apa_verbose.csl' and Bibliography file '(...)/tmpzt7t8p0y/temp.bib'...
DEBUG   -  ----SUCCESS Converting pandoc citation key '[@bar2024]' with CSL file 'docs/bib/apa_verbose.csl' and Bibliography file '(...)/tmpzt7t8p0y/temp.bib'
DEBUG   -  --SUCCESS Rendering citation inline for '[@bar2024]'
DEBUG   -  SUCCESS Replacing citation keys with the generated ones
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/shyamd/mkdocs-bibtex/",
    "name": "mkdocs-bibtex",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "mkdocs python markdown bibtex",
    "author": "Shyam Dwaraknath",
    "author_email": "shyamd@lbl.gov",
    "download_url": "https://files.pythonhosted.org/packages/48/57/b0b35ad267efe96dc50afdba4ed52dba317fae012ca1f5e6a032804a3a97/mkdocs-bibtex-2.15.0.tar.gz",
    "platform": null,
    "description": "[![testing](https://github.com/shyamd/mkdocs-bibtex/workflows/testing/badge.svg)](https://github.com/shyamd/mkdocs-bibtex/actions?query=workflow%3Atesting)\n[![codecov](https://codecov.io/gh/shyamd/mkdocs-bibtex/branch/main/graph/badge.svg)](https://codecov.io/gh/shyamd/mkdocs-bibtex)\n[![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/shyamd/mkdocs-bibtex.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/shyamd/mkdocs-bibtex/context:python)\n\n# mkdocs-bibtex\n\nA [MkDocs](https://www.mkdocs.org/) plugin for citation management using bibtex.\n\n## Setup\n\nInstall the plugin using pip:\n\n```\npip install mkdocs-bibtex\n```\n> *Note:* This plugin requires pandoc to be installed on your system.<br>\n> If you're having trouble with pandoc, try installing the conda-forge version of pypandoc: `conda install -c conda-forge pypandoc` which will install a version with built in pandoc binaries\n\n\nNext, add the following lines to your `mkdocs.yml`:\n\n```yml\nplugins:\n  - search\n  - bibtex:\n      bib_file: \"refs.bib\"\nmarkdown_extensions:\n  - footnotes\n```\n\nThe footnotes extension is how citations are linked for now.\n\n> If you have no `plugins` entry in your config file yet, you'll likely also want to add the `search` plugin. MkDocs enables it by default if there is no `plugins` entry set.\n\n## Options\n\n- `bib_file` - The path or url to a single bibtex file. Path can either be absolute or relative to `mkdocs.yml`. Example URL: `https://api.zotero.org/*/items?format=bibtex`\n- `bib_dir` - Directory for bibtex files to load, same as above for path resolution\n- `bib_command` - The syntax to render your bibliography, defaults to `\\bibliography`\n- `bib_by_default` - Automatically append the `bib_command` at the end of every markdown document, defaults to `true`\n- `full_bib_command` - The syntax to render your entire bibliography, defaults to `\\full_bibliography`\n- `csl_file` - The path or url to a bibtex CSL file, specifying your citation format. Defaults to `None`, which renders in a plain format. A registry of citation styles can be found here: https://github.com/citation-style-language/styles\n- `cite_inline` - Whether or not to render citations inline, requires `csl_file` to be specified. Defaults to `False`.\n\n## Usage\n\nIn your markdown files:\n\n1. Add your citations as you would if you used pandoc, IE: `[@first_cite;@second_cite]`\n2. Add `\\bibliography`, or the value of `bib_command`, to the doc you want your references rendered (if `bib_by_default` is set to true this is automatically applied for every page).\n3. (Optional) Add `\\full_bibliography`, or the value of `full_bib_command`, to where you want the full bibliography rendered. *Note*: This is currently not working properly, since this plugin can't dictate the order in which files are processed. The best way to ensure the file with the full bibliography gets processed last is to use numbers in front of file/folder names to enforce the order of processing, IE: `01_my_first_file.md`\n4. (Optional) Configure the `csl_file` option to dictate the citation text formatting.\n\n## Debugging\n\nYou may wish to use the verbose flag in mkdocs (`-v`) to log debug messages. You should see something like this\n\n```bash\n(...)\nDEBUG   -  Parsing bibtex file 'docs/bib/papers.bib'...\nINFO    -  SUCCESS Parsing bibtex file 'docs/bib/papers.bib'\nDEBUG   -  Downloading CSL file from URL https://raw.githubusercontent.com/citation-style-language/styles/master/apa-6th-edition.csl to temporary file...\nINFO    -  CSL file downladed from URL https://raw.githubusercontent.com/citation-style-language/styles/master/apa-6th-edition.csl to temporary file (<tempfile._TemporaryFileWrapper object at 0x00000203E4F2F650>)\n(...)\nDEBUG   -  Reading: publications.md\nDEBUG   -  Running 2 `page_markdown` events\nDEBUG   -  Formatting all bib entries...\nDEBUG   -  --Converting bibtex entry 'foo2019' with CSL file 'docs/bib/apa_verbose.csl' using pandoc>=2.11\nDEBUG   -  --SUCCESS Converting bibtex entry 'foo2019' with CSL file 'docs/bib/apa_verbose.csl' using pandoc>=2.11\nDEBUG   -  --Converting bibtex entry 'bar2024' with CSL file 'docs/bib/apa_verbose.csl' using pandoc>=2.11\nDEBUG   -  --SUCCESS Converting bibtex entry 'bar2024' with CSL file 'docs/bib/apa_verbose.csl' using pandoc>=2.11\nINFO    -  SUCCESS Formatting all bib entries\nDEBUG   -  Replacing citation keys with the generated ones...\nDEBUG   -  --Rendering citation inline for '[@foo2019]'...\nDEBUG   -  ----Converting pandoc citation key '[@foo2019]' with CSL file 'docs/bib/apa_verbose.csl' and Bibliography file '(...)/tmpzt7t8p0y/temp.bib'...\nDEBUG   -  ----SUCCESS Converting pandoc citation key '[@foo2019]' with CSL file 'docs/bib/apa_verbose.csl' and Bibliography file '(...)/tmpzt7t8p0y/temp.bib'\nDEBUG   -  --SUCCESS Rendering citation inline for '[@foo2019]'\nDEBUG   -  --Rendering citation inline for '[@bar2024]'...\nDEBUG   -  ----Converting pandoc citation key '[@bar2024]' with CSL file 'docs/bib/apa_verbose.csl' and Bibliography file '(...)/tmpzt7t8p0y/temp.bib'...\nDEBUG   -  ----SUCCESS Converting pandoc citation key '[@bar2024]' with CSL file 'docs/bib/apa_verbose.csl' and Bibliography file '(...)/tmpzt7t8p0y/temp.bib'\nDEBUG   -  --SUCCESS Rendering citation inline for '[@bar2024]'\nDEBUG   -  SUCCESS Replacing citation keys with the generated ones\n```\n",
    "bugtrack_url": null,
    "license": "BSD-3-Clause-LBNL",
    "summary": "An MkDocs plugin that enables managing citations with BibTex",
    "version": "2.15.0",
    "project_urls": {
        "Homepage": "https://github.com/shyamd/mkdocs-bibtex/"
    },
    "split_keywords": [
        "mkdocs",
        "python",
        "markdown",
        "bibtex"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "56ca444e4b6de6c1dc23d6a2aa0aad69c233f1bc9473a0aa015ae32635f0d580",
                "md5": "1707e1fa3636f1d640d36d98c95c8da8",
                "sha256": "f26cae885f822346f1d9dcd40fdb3f50396bfd09d7a6be83c09e535bd8896cc4"
            },
            "downloads": -1,
            "filename": "mkdocs_bibtex-2.15.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1707e1fa3636f1d640d36d98c95c8da8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 11505,
            "upload_time": "2024-04-04T14:33:29",
            "upload_time_iso_8601": "2024-04-04T14:33:29.714046Z",
            "url": "https://files.pythonhosted.org/packages/56/ca/444e4b6de6c1dc23d6a2aa0aad69c233f1bc9473a0aa015ae32635f0d580/mkdocs_bibtex-2.15.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4857b0b35ad267efe96dc50afdba4ed52dba317fae012ca1f5e6a032804a3a97",
                "md5": "e77b99dcec07c7794e8ccf0ffab0ed97",
                "sha256": "9aacb98e944c48e3f21b76e3d6774890ae7bcec347f48a323dbc7a7c63a7fa6d"
            },
            "downloads": -1,
            "filename": "mkdocs-bibtex-2.15.0.tar.gz",
            "has_sig": false,
            "md5_digest": "e77b99dcec07c7794e8ccf0ffab0ed97",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 21660,
            "upload_time": "2024-04-04T14:33:31",
            "upload_time_iso_8601": "2024-04-04T14:33:31.896705Z",
            "url": "https://files.pythonhosted.org/packages/48/57/b0b35ad267efe96dc50afdba4ed52dba317fae012ca1f5e6a032804a3a97/mkdocs-bibtex-2.15.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-04 14:33:31",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "shyamd",
    "github_project": "mkdocs-bibtex",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "requirements": [],
    "lcname": "mkdocs-bibtex"
}
        
Elapsed time: 0.21423s