{"id":17801759,"url":"https://github.com/jfishe/panvimwiki","last_synced_at":"2025-03-17T11:30:51.736Z","repository":{"id":62698225,"uuid":"314638869","full_name":"jfishe/panvimwiki","owner":"jfishe","description":"Python module for converting Vimwiki to other formats using Pandoc","archived":false,"fork":false,"pushed_at":"2024-04-06T11:35:42.000Z","size":465,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-04-06T12:30:39.341Z","etag":null,"topics":["pandoc","pandoc-filter","vimwiki"],"latest_commit_sha":null,"homepage":"http://panvimwiki.readthedocs.io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jfishe.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.md","dei":null}},"created_at":"2020-11-20T18:34:14.000Z","updated_at":"2024-04-14T22:37:58.227Z","dependencies_parsed_at":"2024-01-13T19:07:19.384Z","dependency_job_id":"2b6ec911-0b67-4b79-918e-4ee97be8924c","html_url":"https://github.com/jfishe/panvimwiki","commit_stats":{"total_commits":144,"total_committers":1,"mean_commits":144.0,"dds":0.0,"last_synced_commit":"374fc530fe1011e5aa22825f0512927550316285"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfishe%2Fpanvimwiki","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfishe%2Fpanvimwiki/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfishe%2Fpanvimwiki/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfishe%2Fpanvimwiki/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jfishe","download_url":"https://codeload.github.com/jfishe/panvimwiki/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243858576,"owners_count":20359376,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pandoc","pandoc-filter","vimwiki"],"created_at":"2024-10-27T12:39:28.596Z","updated_at":"2025-03-17T11:30:51.723Z","avatar_url":"https://github.com/jfishe.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\ndescription: Filter and convert Vimwiki notes using pandoc.\nproject: panvimwiki\ntoc: true\nvimversion: Vim v9.0\n---\n\n\u003c!-- These are examples of badges you might want to add to your README:\n     please update the URLs accordingly\n\n[![Built Status](https://api.cirrus-ci.com/github/\u003cUSER\u003e/panvimwiki.svg?branch=main)](https://cirrus-ci.com/github/\u003cUSER\u003e/panvimwiki)\n[![ReadTheDocs](https://readthedocs.org/projects/panvimwiki/badge/?version=latest)](https://panvimwiki.readthedocs.io/en/stable/)\n[![Coveralls](https://img.shields.io/coveralls/github/\u003cUSER\u003e/panvimwiki/main.svg)](https://coveralls.io/r/\u003cUSER\u003e/panvimwiki)\n[![PyPI-Server](https://img.shields.io/pypi/v/panvimwiki.svg)](https://pypi.org/project/panvimwiki/)\n[![Conda-Forge](https://img.shields.io/conda/vn/conda-forge/panvimwiki.svg)](https://anaconda.org/conda-forge/panvimwiki)\n[![Monthly Downloads](https://pepy.tech/badge/panvimwiki/month)](https://pepy.tech/project/panvimwiki)\n[![Twitter](https://img.shields.io/twitter/url/http/shields.io.svg?style=social\u0026label=Twitter)](https://twitter.com/panvimwiki)\n--\u003e\n\n# Filter and convert Vimwiki notes using pandoc\n\n[![Documentation Status][]][1] [![PyPI-Server][]][2] [![Test and Publish\nPython 🐍 distribution 📦 to PyPI and TestPyPI][]][3] [![Project\ngenerated with PyScaffold]][4]\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n\n## Introduction\n\nPanvimwiki provides tools for conversion to Microsoft Word docx or other\noutput formats supported by [Pandoc] Panvimwiki provides command line\ntools as well as Vim commands to concatenate and convert Diary Notes or\nconvert any Vimwiki note.\n\n## Installation\n\nPanvimwiki requires [Pandoc] Installation with `conda` is recommended\nbecause the system version, e.g., with Ubuntu, may be too old. Or\ndownload from the website. [Pypandoc] supports binary installation of\npandoc using `pip`.\n\nUsing the Vim 8 native packages, panvimwiki should install in\n`pack/*/opt/panvimwiki` because it depends on [:python3] and requires\ninstallation of the python package panvimwiki.\n\nFrom a bash shell, enter the following:\n\n```bash\n# Adjust dest to suit, e.g., $HOME/vimfiles/pack/vimwiki/opt/panvimwiki\ndest=\"$HOME/.vim/pack/vimwiki/opt/panvimwiki\"\n\ngit clone https://github.com/jfishe/panvimwiki.git \"$dest\"\n\n# Activate the python environment used by Vim.\n# Then install panvimwiki in that python environment.\npython -m pip install \"$dest\"\n# Or to install from pypi:\npython -m pip install panvimwiki\n```\n\nPanvimwiki requires Vim compiled with Python 3, so add the following to\n[vimrc] prior to [:filetype-plugin-on]. See [:packadd] for an\nexplanation. Otherwise, install panvimwiki in `pack/*/start/panvimwiki`.\n\n```vim\nif has('python3')\n  packadd! panvimwiki\nendif\n```\n\nInstall [Conquer of Completion (CoC)] to use [Zettelkasten completion](#completion).\n\n## Usage\n\n### Completion\n\nConquer of Completion (CoC) can complete [Vim-Zettel] YAML header fields:\n\n- `type:` note, literature, reference, or index.\n- `status:` Create, Process, or Reviewed.\n\nRefer to `:h vim-zettel.txt`, especially `:h g:zettel_options`.\n\n### Command Line Shell\n\nPanvimwiki provides plain text pre-filters and pandoc filters for use\nfrom the command line.\n\nFor example from a bash prompt:\n\n```bash\ncat $HOME/vimwiki/diary/* |\n    delete_bullet_star |\n    delete_task_pending |\npandoc --from=vimwiki --to=markdown \\\n    --filter=delete_tag_lines \\\n    --filter=delete_taskwiki_heading \\\n    --filter=delete_empty_heading\n```\n\nFrom python:\n\n```python\nfrom pathlib import Path\nfrom panvimwiki.convert import convert\n\nPREFILTER = (\n    \"delete_bullet_star\",\n    \"delete_task_pending\",\n)\nFILTER = (\n    \"delete_tag_lines\",\n    \"delete_empty_heading\",\n    \"delete_taskwiki_heading\",\n)\nEXTRA_ARGS = (\n    \"--shift-heading-level-by\",\n    \"1\",\n    \"--data-dir\",\n    str(Path.home() / \"vimwiki_html/templates\"),\n)\n\nconvert(\n    inputfile=str(Path.home() / \"vimwiki/index.wiki\"),\n    outputfile=str(Path.home() / \"vimwiki_html/markdown/index.md\"),\n    to=\"markdown\",\n    prefilters=PREFILTER,\n    filters=FILTER,\n    extra_args=EXTRA_ARGS,\n)\n```\n\n#### Pre-Filters\n\n##### delete_bullet_star\n\nRemove unordered lists which use the star (asterisk) bullet marker.\n\nThe pre-filter does not remove task list items (see\n[delete_task_pending]). The pre-filter does not handle wrapped\nbullets--i.e., it will delete the bulleted-line and leave the wrapped\nlines. I haven't figured out a good regex for wrapped lines.\n\n```bash\necho '- Bulleted list item 1 should appear' \\\n     '* Bulleted list item 6 should NOT appear' |\ndelete_bullet_star\n```\n\n```text\n- Bulleted list item 1 should appear\n```\n\n##### delete_task_pending\n\nDelete pending tasks.\n\n```bash\necho '- [ ] Bulleted list done0 item 0 should NOT appear' \\\n     '- [.] Bulleted list done1 item 1 should appear' |\ndelete_task_pending\n```\n\n```text\n- [.] Bulleted list done1 item 1 should appear\n```\n\n#### Pandoc Filters\n\nPanvimwiki provides plain text pre-filters, pandoc filters and\npost-filters for use from the command line.\n\n##### delete_tag_lines\n\nDelete lines which only contain Vimwiki tags, e.g., ':tag1:tag2:'\n\n##### delete_empty_heading\n\nRemove headings that do not have any children or paragraphs. Remove tag\nlines first, [delete_tag_lines] or the heading is not considered empty.\n\n##### delete_taskwiki_heading\n\n#### Post-Filters\n\n##### reference_citation\n\nConvert citations to a reference list.\n\n`Example.md`:\n\n```markdown\n::::: {#refs .references .csl-bib-body .hanging-indent entry-spacing=\"0\"}\n::: {#ref-bloggs-jones .csl-entry}\nBloggs, A. J., and X. Y. Jones. 1959. \"Title Title Title Title Title Title\nTitle Title Title Title.\" _Journal Journal Journal_. :::\n\n::: {#ref-chomsky-73 .csl-entry}\nChomsky, N. 1973. \"Conditions on Transformations.\" In _A Festschrift for Morris\nHalle_, edited by S. R. Anderson and P. Kiparsky. New York: Holt, Rinehart \u0026\nWinston.\n:::\n:::::\n```\n\n`reference_citation \u003c Example.md` produces:\n\n```markdown\n[#ref-bloggs-jones]: Bloggs, A. J., and X. Y. Jones. 1959. \"Title Title Title Title\nTitle Title Title Title Title Title.\" _Journal Journal Journal_.\n\n[#ref-chomsky-73]: Chomsky, N. 1973. \"Conditions on Transformations.\" In _A\nFestschrift for Morris Halle_, edited by S. R. Anderson and P. Kiparsky.\nNew York: Holt, Rinehart \u0026 Winston.\n```\n\n###### wikilink_markdown\n\nConvert [Pandoc] markdown tasks and wikilinks to `:h vimwiki-todo-lists`\nand markdown links compatible with `:h vimwiki-syntax-links`.\n\n### Commands\n\n#### Local Commands\n\nThese commands are only available (and meaningful) when you are\ncurrently in a Vimwiki file.\n\n##### VimwikiConvert\\[!\\]\n\nConvert the current Vimwiki buffer. With !, open with default viewer.\n\nConvert the current Vimwiki [:buffer] to the selected output format (default:\ndocx) specified in [g:panvimwiki_settings].\n\nCopy the path to the Word file to the clipboard register \"+ [quoteplus].\nOn Windows Subsystem for Linux (WSL), convert the path from POSIX to\nWindows before copying to clipboard.\n\nRemove extraneous info:\n\n- Vimwiki tag lines, e.g., :tag1:tag2:\n- Not started tasks, e.g., - \\[ \\] Task1\n- Non-task bullet lines, e.g., `* [[URI|Description]]` or `* Text`\n- Remove empty parent/child headings.\n\n##### VimwikiConvertWeek\\[!\\]\n\nConcatenate DiaryNotes for Monday through current buffer and convert.\nWith !, open in default viewer.\n\nAfter concatenating DiaryNotes for the week, behave as [VimwikiConvert].\n\n##### VimwikiReference\n\nIf in markdown format, expand [Pandoc Citations] in the current file and\nappend to the end of the file. The Yaml metadata should [specify the\nbibliographic data] and the [Citation Style Language (CSL)].\n\nAdd the following to `.markdownlint.yml` to suppress `MD033`:\n\n```yaml\n# MD033/no-inline-html : Inline HTML :\n# https://github.com/DavidAnson/markdownlint/blob/main/doc/md033.md\nMD033:\n  # MD033/no-inline-html Inline HTML [Element: div]\n  # Allowed elements\n  allowed_elements:\n    - \"div\"\n```\n\n`VimwikiReference` overwrites the file, so Vim may prompt to reload the\nbuffer (cf. Warning `:h W12`). If you choose not to reload the buffer,\n`:h :DiffOrig` facilitate review of the changes.\n\n##### VimwikiMarkdownFormat\n\nIf in markdown format, convert `:h vimwiki-syntax-links`\n[wikilinks_title_after_pipe] to [Inline links],\nwithout the \"wikilink\" title that pandoc adds by default.\nPreserve `:h vimwiki-todo-lists`, using [task_lists].\n\n`VimwikiMarkdownFormat` overwrites the file, so Vim may prompt to reload the\nbuffer (cf. Warning `:h W12`). If you choose not to reload the buffer,\n`:h :DiffOrig` facilitate review of the changes.\n\n### Settings\n\n#### Global Settings\n\n##### g:panvimwiki_settings\n\nOptionally add the following to or, preferably,\n'\\~/.vim/plugin/vimwiki.vim'. Panvimwiki defaults to docx format,\nwithout extra_args.\n\n```vim\nlet g:panvimwiki_settings = {\n      \\ 'extra_args': [ '--shift-heading-level-by', '1',\n      \\ '--data-dir', '~/vimwiki_html/templates/'\n      \\ ],\n      \\ 'format': 'docx'\n      \\ }\n```\n\n## Development and Testing\n\nBecause pandoc is required, a conda environment called `panvimwiki` is\ncreated. The default name may be overridden with the\n`--name \u003cenvironment name\u003e` parameter.\n\n```bash\ngit clone https://github.com/jfishe/panvimwiki.git\ncd panvimwiki\nconda env create --file environment.yml\nconda activate panvimwiki\n```\n\n```bash\ntox -av # List tox commands and descriptions.\ntox --recreate # Build the package and run tests with python and Vader.\ntox -e vim # Run Vader tests and generate coverage report.\n# Run Vader tests and view results with Vim.\nvim -Nu tests/vim/vimrc -c 'Vader tests/vim/*.vader'\n```\n\n\u003c!-- pyscaffold-notes --\u003e\n\n## Note\n\nThis project has been set up using PyScaffold 4.5. For details and usage\ninformation on PyScaffold see \u003chttps://pyscaffold.org/\u003e.\n\n\u003c!-- References --\u003e\n\n[1]: https://panvimwiki.readthedocs.io/en/latest/?badge=latest\n[2]: https://pypi.org/project/panvimwiki/\n[3]: https://github.com/jfishe/panvimwiki/actions/workflows/ci.yml\n[4]: https://pyscaffold.org/\n[:buffer]: https://neovim.io/doc/user/windows.html#%3Abuffer\n[:filetype-plugin-on]: https://neovim.io/doc/user/filetype.html#filetype\n[:packadd]: https://neovim.io/doc/user/repeat.html#%3Apackadd\n[:python3]: https://neovim.io/doc/user/if_pyth.html#python3\n[Citation Style Language (CSL)]: https://pandoc.org/MANUAL.html#specifying-a-citation-style\n[Conquer of Completion (CoC)]: https://github.com/neoclide/coc.nvim\n[Documentation Status]: https://readthedocs.org/projects/panvimwiki/badge/?version=latest\n[Inline links]: https://pandoc.org/MANUAL.html#inline-links\n[Pandoc Citations]: https://pandoc.org/MANUAL.html#citation-syntax\n[Pandoc]: https://pandoc.org/\n[Project generated with PyScaffold]: https://img.shields.io/badge/-PyScaffold-005CA0?logo=pyscaffold\n[PyPI-Server]: https://img.shields.io/pypi/v/panvimwiki.svg\n[Pypandoc]: https://github.com/JessicaTegner/pypandoc?tab=readme-ov-file#installing-via-pip\n[Test and Publish Python 🐍 distribution 📦 to PyPI and TestPyPI]: https://github.com/jfishe/panvimwiki/actions/workflows/ci.yml/badge.svg\n[VimwikiConvert]: #vimwikiconvert\n[delete_tag_lines]: #delete_tag_lines\n[delete_task_pending]: #delete_task_pending\n[quoteplus]: https://neovim.io/doc/user/provider.html#quoteplus\n[specify the bibliographic data]: https://pandoc.org/MANUAL.html#specifying-bibliographic-data\n[task_lists]: https://pandoc.org/MANUAL.html#extension-task_lists\n[vimrc]: https://neovim.io/doc/user/starting.html\n[Vim-Zettel]: https://github.com/michal-h21/vim-zettel\n[wikilinks_title_after_pipe]: https://pandoc.org/MANUAL.html#extension-wikilinks_title_after_pipe\n\n\u003c!-- markdownlint-disable MD051 --\u003e\n\n[g:panvimwiki_settings]: #g-panvimwiki-settings\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjfishe%2Fpanvimwiki","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjfishe%2Fpanvimwiki","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjfishe%2Fpanvimwiki/lists"}