├── .JuliaFormatter.toml ├── .github ├── FUNDING.yml └── workflows │ ├── docs.yml │ ├── panvimdoc.yml │ └── test.yml ├── .gitignore ├── .pre-commit-hooks.yaml ├── .stylua.toml ├── Dockerfile ├── LICENSE ├── Manifest.toml ├── Project.toml ├── README.md ├── action.yaml ├── doc ├── .gitkeep ├── panvimdoc.md └── panvimdoc.txt ├── justfile ├── lib ├── Demojify.lua └── init.lua ├── panvimdoc.pre-commit.sh ├── panvimdoc.sh ├── public ├── .nojekyll ├── css │ ├── paper.css │ ├── skylighting-paper-theme.css │ ├── skylighting-solarized-theme.css │ ├── theme.css │ └── tufte.css ├── fonts │ ├── atlas-grotesk │ │ ├── AtlasGrotesk-Bold-190618-Web.woff2 │ │ ├── AtlasGrotesk-BoldItalic-190618-Web.woff2 │ │ ├── AtlasGrotesk-Medium-190618-Web.woff2 │ │ ├── AtlasGrotesk-MediumItalic-190618-Web.woff2 │ │ ├── AtlasGrotesk-Regular-190618-Web.woff2 │ │ ├── AtlasGrotesk-RegularItalic-190618-Web.woff2 │ │ ├── AtlasGrotesk-Semi-190618-Web.woff2 │ │ └── AtlasGrotesk-SemiItalic-190618-Web.woff2 │ ├── et-book │ │ ├── et-book-bold-line-figures │ │ │ ├── et-book-bold-line-figures.eot │ │ │ ├── et-book-bold-line-figures.svg │ │ │ ├── et-book-bold-line-figures.ttf │ │ │ └── et-book-bold-line-figures.woff │ │ ├── et-book-display-italic-old-style-figures │ │ │ ├── et-book-display-italic-old-style-figures.eot │ │ │ ├── et-book-display-italic-old-style-figures.svg │ │ │ ├── et-book-display-italic-old-style-figures.ttf │ │ │ └── et-book-display-italic-old-style-figures.woff │ │ ├── et-book-roman-line-figures │ │ │ ├── et-book-roman-line-figures.eot │ │ │ ├── et-book-roman-line-figures.svg │ │ │ ├── et-book-roman-line-figures.ttf │ │ │ └── et-book-roman-line-figures.woff │ │ ├── et-book-roman-old-style-figures │ │ │ ├── et-book-roman-old-style-figures.eot │ │ │ ├── et-book-roman-old-style-figures.svg │ │ │ ├── et-book-roman-old-style-figures.ttf │ │ │ └── et-book-roman-old-style-figures.woff │ │ └── et-book-semi-bold-old-style-figures │ │ │ ├── et-book-semi-bold-old-style-figures.eot │ │ │ ├── et-book-semi-bold-old-style-figures.svg │ │ │ ├── et-book-semi-bold-old-style-figures.ttf │ │ │ └── et-book-semi-bold-old-style-figures.woff │ └── source-code-pro │ │ ├── SourceCodePro-Bold-2030.otf.woff2 │ │ ├── SourceCodePro-BoldIt-1050.otf.woff2 │ │ ├── SourceCodePro-It-1050.otf.woff2 │ │ └── SourceCodePro-Regular-2030.otf.woff2 └── img │ ├── dark-desktop.png │ ├── dark-mobile-responsive.png │ ├── dark-mobile.png │ ├── el-capitan-from-four-mile-trail.jpg │ ├── light-desktop.png │ ├── light-mobile-responsive.png │ ├── light-mobile.png │ ├── sugarloaf-hill-forest-green.jpg │ ├── sugarloaf-hill-forest-green@3x.jpg │ ├── sugarloaf-hill-trail-april-june.jpg │ ├── sugarloaf-hill-trail-april-june@2x.jpg │ ├── upper-crystal-springs-reservoir-facing-northwest.jpg │ └── upper-crystal-springs-reservoir-facing-southwest.jpg ├── scripts ├── include-files.lua ├── logging.lua ├── panvimdoc.lua ├── remove-emojis.lua ├── skip-blocks.lua └── template.html5 ├── src └── panvimdoc.jl └── test ├── dedupheadings.jl ├── definition-lists.jl ├── demojify.jl ├── description.jl ├── headinglevelsby.jl ├── help.jl ├── ignore_rawblock.jl ├── mapping.jl ├── markdown.jl ├── para.jl ├── runtests.jl ├── tables.jl ├── toc-emojis.jl ├── toc.jl └── treesitter.jl /.JuliaFormatter.toml: -------------------------------------------------------------------------------- 1 | indent = 2 2 | margin = 120 3 | always_for_in = true 4 | remove_extra_newlines = true 5 | pipe_to_function_call = true 6 | format_docstrings = true 7 | normalize_line_endings = "unix" 8 | separate_kwargs_with_semicolon = true 9 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: [kdheepak] 2 | custom: ['https://donate.stripe.com/8wM9E7bBO9ZsbGUdQR'] 3 | -------------------------------------------------------------------------------- /.github/workflows/docs.yml: -------------------------------------------------------------------------------- 1 | name: docs 2 | 3 | on: 4 | push: 5 | branches: main 6 | 7 | permissions: 8 | contents: write 9 | 10 | jobs: 11 | publish-gh-page: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: checkout code 15 | uses: actions/checkout@v3 16 | - name: pandoc markdown to html 17 | uses: docker://pandoc/latex:3.1 18 | with: 19 | args: >- 20 | --katex 21 | --from markdown+tex_math_single_backslash 22 | --to html5+smart 23 | --template="./scripts/template.html5" 24 | --css="/panvimdoc/css/theme.css" 25 | --css="/panvimdoc/css/skylighting-solarized-theme.css" 26 | --toc 27 | --wrap=none 28 | --metadata title="panvimdoc" 29 | doc/panvimdoc.md 30 | --lua-filter=scripts/include-files.lua 31 | --lua-filter=scripts/skip-blocks.lua 32 | -t html 33 | -o public/index.html 34 | - name: deploy to GitHub pages 35 | uses: JamesIves/github-pages-deploy-action@v4 36 | with: 37 | branch: gh-pages 38 | folder: public 39 | -------------------------------------------------------------------------------- /.github/workflows/panvimdoc.yml: -------------------------------------------------------------------------------- 1 | name: panvimdoc 2 | 3 | on: [push] 4 | 5 | jobs: 6 | custom_test: 7 | runs-on: ubuntu-latest 8 | name: pandoc to vimdoc 9 | steps: 10 | - uses: actions/checkout@v2 11 | - name: panvimdoc 12 | uses: ./ 13 | with: 14 | vimdoc: panvimdoc 15 | pandoc: doc/panvimdoc.md 16 | treesitter: true 17 | - uses: stefanzweifel/git-auto-commit-action@v4 18 | with: 19 | commit_message: "Auto generate docs" 20 | branch: ${{ github.head_ref }} 21 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Test 2 | 3 | on: 4 | push: 5 | pull_request: 6 | 7 | jobs: 8 | test: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - name: Checkout code 12 | uses: actions/checkout@v2 13 | - uses: julia-actions/setup-julia@v1 14 | with: 15 | version: 1.9 16 | arch: x64 17 | - uses: julia-actions/julia-buildpkg@v1 18 | - name: Build Docker image 19 | run: docker build -t test-image . 20 | - uses: julia-actions/julia-runtest@v1 21 | with: 22 | annotate: true 23 | env: 24 | DOCKER_IMAGE: test-image 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | doc/tags 2 | -------------------------------------------------------------------------------- /.pre-commit-hooks.yaml: -------------------------------------------------------------------------------- 1 | - id: panvimdoc-docker 2 | name: pandoc to vimdoc (docker) 3 | description: Convert markdown documentation to vimdoc (using docker) 4 | entry: /panvimdoc.pre-commit.sh 5 | language: docker 6 | files: ^README\.md$ 7 | args: 8 | - '--input-file' 9 | - README.md 10 | pass_filenames: false 11 | - id: panvimdoc 12 | name: pandoc to vimdoc 13 | description: Convert markdown documentation to vimdoc (using local environment) 14 | entry: panvimdoc.pre-commit.sh 15 | language: script 16 | files: ^README\.md$ 17 | args: 18 | - '--input-file' 19 | - README.md 20 | pass_filenames: false 21 | -------------------------------------------------------------------------------- /.stylua.toml: -------------------------------------------------------------------------------- 1 | indent_type = "Spaces" 2 | indent_width = 2 3 | quote_style = "ForceDouble" 4 | no_call_parentheses = false 5 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM pandoc/core:3.1 2 | 3 | RUN apk update && apk upgrade && apk add bash vim neovim 4 | 5 | # Copies your code file repository to the filesystem 6 | COPY panvimdoc.sh /panvimdoc.sh 7 | COPY panvimdoc.pre-commit.sh /panvimdoc.pre-commit.sh 8 | COPY scripts/ /scripts/ 9 | COPY lib/Demojify.lua /usr/share/lua/common/lib/Demojify.lua 10 | 11 | # change permission to execute the script and 12 | RUN chmod +x /panvimdoc.sh 13 | RUN chmod +x /panvimdoc.pre-commit.sh 14 | 15 | # file to execute when the docker container starts up 16 | ENTRYPOINT ["/panvimdoc.sh"] 17 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Dheepak Krishnamurthy 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Manifest.toml: -------------------------------------------------------------------------------- 1 | # This file is machine-generated - editing it directly is not advised 2 | 3 | julia_version = "1.9.2" 4 | manifest_format = "2.0" 5 | project_hash = "14665feaa1f642ac968d7a294ef475d6f1d69e4e" 6 | 7 | [[deps.Artifacts]] 8 | uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" 9 | 10 | [[deps.Base64]] 11 | uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" 12 | 13 | [[deps.Compat]] 14 | deps = ["UUIDs"] 15 | git-tree-sha1 = "e460f044ca8b99be31d35fe54fc33a5c33dd8ed7" 16 | uuid = "34da2185-b29b-5c13-b0c7-acf172513d20" 17 | version = "4.9.0" 18 | 19 | [deps.Compat.extensions] 20 | CompatLinearAlgebraExt = "LinearAlgebra" 21 | 22 | [deps.Compat.weakdeps] 23 | Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" 24 | LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" 25 | 26 | [[deps.DataStructures]] 27 | deps = ["Compat", "InteractiveUtils", "OrderedCollections"] 28 | git-tree-sha1 = "3dbd312d370723b6bb43ba9d02fc36abade4518d" 29 | uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" 30 | version = "0.18.15" 31 | 32 | [[deps.Dates]] 33 | deps = ["Printf"] 34 | uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" 35 | 36 | [[deps.DeepDiffs]] 37 | git-tree-sha1 = "9824894295b62a6a4ab6adf1c7bf337b3a9ca34c" 38 | uuid = "ab62b9b5-e342-54a8-a765-a90f495de1a6" 39 | version = "1.2.0" 40 | 41 | [[deps.Distributed]] 42 | deps = ["Random", "Serialization", "Sockets"] 43 | uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b" 44 | 45 | [[deps.DocStringExtensions]] 46 | deps = ["LibGit2"] 47 | git-tree-sha1 = "2fb1e02f2b635d0845df5d7c167fec4dd739b00d" 48 | uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" 49 | version = "0.9.3" 50 | 51 | [[deps.EnumX]] 52 | git-tree-sha1 = "bdb1942cd4c45e3c678fd11569d5cccd80976237" 53 | uuid = "4e289a0a-7415-4d19-859d-a7e5c4648b56" 54 | version = "1.0.4" 55 | 56 | [[deps.FilePathsBase]] 57 | deps = ["Compat", "Dates", "Mmap", "Printf", "Test", "UUIDs"] 58 | git-tree-sha1 = "e27c4ebe80e8699540f2d6c805cc12203b614f12" 59 | uuid = "48062228-2e41-5def-b9a4-89aafe57970f" 60 | version = "0.9.20" 61 | 62 | [[deps.InlineTest]] 63 | deps = ["Test"] 64 | git-tree-sha1 = "daf0743879904f0ad645ca6594e1479685f158a2" 65 | uuid = "bd334432-b1e7-49c7-a2dc-dd9149e4ebd6" 66 | version = "0.2.0" 67 | 68 | [[deps.InteractiveUtils]] 69 | deps = ["Markdown"] 70 | uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" 71 | 72 | [[deps.JLLWrappers]] 73 | deps = ["Preferences"] 74 | git-tree-sha1 = "abc9885a7ca2052a736a600f7fa66209f96506e1" 75 | uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210" 76 | version = "1.4.1" 77 | 78 | [[deps.JSON3]] 79 | deps = ["Dates", "Mmap", "Parsers", "PrecompileTools", "StructTypes", "UUIDs"] 80 | git-tree-sha1 = "95220473901735a0f4df9d1ca5b171b568b2daa3" 81 | uuid = "0f8b85d8-7281-11e9-16c2-39a750bddbf1" 82 | version = "1.13.2" 83 | 84 | [[deps.LibGit2]] 85 | deps = ["Base64", "NetworkOptions", "Printf", "SHA"] 86 | uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" 87 | 88 | [[deps.Libdl]] 89 | uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" 90 | 91 | [[deps.Logging]] 92 | uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" 93 | 94 | [[deps.LoggingExtras]] 95 | deps = ["Dates", "Logging"] 96 | git-tree-sha1 = "cedb76b37bc5a6c702ade66be44f831fa23c681e" 97 | uuid = "e6f89c97-d47a-5376-807f-9c37f3926c36" 98 | version = "1.0.0" 99 | 100 | [[deps.Markdown]] 101 | deps = ["Base64"] 102 | uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" 103 | 104 | [[deps.Mmap]] 105 | uuid = "a63ad114-7e13-5084-954f-fe012c677804" 106 | 107 | [[deps.NetworkOptions]] 108 | uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908" 109 | version = "1.2.0" 110 | 111 | [[deps.OrderedCollections]] 112 | git-tree-sha1 = "2e73fe17cac3c62ad1aebe70d44c963c3cfdc3e3" 113 | uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" 114 | version = "1.6.2" 115 | 116 | [[deps.Pandoc]] 117 | deps = ["DataStructures", "DocStringExtensions", "EnumX", "FilePathsBase", "InlineTest", "JSON3", "Markdown", "ReTest", "StructTypes", "pandoc_jll"] 118 | git-tree-sha1 = "51ffbad76bfc6f0dff3f2ba4e2e206587a94a5b7" 119 | uuid = "f853b5e0-b243-11e9-0043-7da5023c5ee7" 120 | version = "0.4.3" 121 | 122 | [[deps.Parsers]] 123 | deps = ["Dates", "PrecompileTools", "UUIDs"] 124 | git-tree-sha1 = "716e24b21538abc91f6205fd1d8363f39b442851" 125 | uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" 126 | version = "2.7.2" 127 | 128 | [[deps.PrecompileTools]] 129 | deps = ["Preferences"] 130 | git-tree-sha1 = "9673d39decc5feece56ef3940e5dafba15ba0f81" 131 | uuid = "aea7be01-6a6a-4083-8856-8a6e6704d82a" 132 | version = "1.1.2" 133 | 134 | [[deps.Preferences]] 135 | deps = ["TOML"] 136 | git-tree-sha1 = "7eb1686b4f04b82f96ed7a4ea5890a4f0c7a09f1" 137 | uuid = "21216c6a-2e73-6563-6e65-726566657250" 138 | version = "1.4.0" 139 | 140 | [[deps.Printf]] 141 | deps = ["Unicode"] 142 | uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7" 143 | 144 | [[deps.Random]] 145 | deps = ["SHA", "Serialization"] 146 | uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" 147 | 148 | [[deps.ReTest]] 149 | deps = ["Distributed", "InlineTest", "Printf", "Random", "Sockets", "Test"] 150 | git-tree-sha1 = "dd8f6587c0abac44bcec2e42f0aeddb73550c0ec" 151 | uuid = "e0db7c4e-2690-44b9-bad6-7687da720f89" 152 | version = "0.3.2" 153 | 154 | [[deps.SHA]] 155 | uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" 156 | version = "0.7.0" 157 | 158 | [[deps.Serialization]] 159 | uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" 160 | 161 | [[deps.Sockets]] 162 | uuid = "6462fe0b-24de-5631-8697-dd941f90decc" 163 | 164 | [[deps.StructTypes]] 165 | deps = ["Dates", "UUIDs"] 166 | git-tree-sha1 = "ca4bccb03acf9faaf4137a9abc1881ed1841aa70" 167 | uuid = "856f2bd8-1eba-4b0a-8007-ebc267875bd4" 168 | version = "1.10.0" 169 | 170 | [[deps.TOML]] 171 | deps = ["Dates"] 172 | uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76" 173 | version = "1.0.3" 174 | 175 | [[deps.Test]] 176 | deps = ["InteractiveUtils", "Logging", "Random", "Serialization"] 177 | uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40" 178 | 179 | [[deps.TestSetExtensions]] 180 | deps = ["DeepDiffs", "Distributed", "Test"] 181 | git-tree-sha1 = "3a2919a78b04c29a1a57b05e1618e473162b15d0" 182 | uuid = "98d24dd4-01ad-11ea-1b02-c9a08f80db04" 183 | version = "2.0.0" 184 | 185 | [[deps.UUIDs]] 186 | deps = ["Random", "SHA"] 187 | uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" 188 | 189 | [[deps.Unicode]] 190 | uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" 191 | 192 | [[deps.pandoc_jll]] 193 | deps = ["Artifacts", "JLLWrappers", "Libdl"] 194 | git-tree-sha1 = "a1cd90615d1ff32a0d4983e5af817ac6d5a504e2" 195 | uuid = "c5432543-76ad-5c9d-82bf-db097047a5e2" 196 | version = "3.1.0+0" 197 | -------------------------------------------------------------------------------- /Project.toml: -------------------------------------------------------------------------------- 1 | name = "panvimdoc" 2 | uuid = "108592c7-02d7-45fd-92a9-4f9366214548" 3 | authors = ["Dheepak Krishnamurthy 12 | 13 | ::: center This software is released under a MIT License. ::: 14 | 15 | # TLDR 16 | 17 | 1. Add the following to `./.github/workflows/panvimdoc.yml`: 18 | 19 | ```yaml 20 | name: panvimdoc 21 | 22 | on: 23 | push: 24 | branches: [main] 25 | paths: 26 | - README.md 27 | - .github/workflows/panvimdoc.yml 28 | 29 | permissions: 30 | contents: write 31 | 32 | jobs: 33 | docs: 34 | runs-on: ubuntu-latest 35 | name: pandoc to vimdoc 36 | steps: 37 | - uses: actions/checkout@v2 38 | - uses: kdheepak/panvimdoc@main 39 | with: 40 | vimdoc: ${{ github.event.repository.name }} 41 | - uses: stefanzweifel/git-auto-commit-action@v4 42 | with: 43 | commit_message: "Auto generate docs" 44 | branch: ${{ github.head_ref }} 45 | ``` 46 | 47 | 2. `README.md` gets converted to `./doc/${{ github.event.repository.name }}.txt` and auto-committed to the repo. 48 | 49 | _Optional_: Add the following to `./.github/dependabot.yml` to auto update your github action dependencies: 50 | 51 | ``` 52 | version: 2 53 | updates: 54 | # Maintain dependencies for GitHub Actions 55 | - package-ecosystem: github-actions 56 | directory: "/" 57 | schedule: 58 | interval: weekly 59 | open-pull-requests-limit: 10 60 | ``` 61 | 62 | # Usage 63 | 64 | ### Generating vimdoc using GitHub Actions 65 | 66 | Create an empty doc file: 67 | 68 | ```bash 69 | touch doc/.gitkeep 70 | git commit -am "Add empty doc folder" 71 | git push 72 | ``` 73 | 74 | Then add the following to `./.github/workflows/panvimdoc.yml`: 75 | 76 | ```yaml 77 | name: panvimdoc 78 | 79 | on: [push] 80 | 81 | jobs: 82 | docs: 83 | runs-on: ubuntu-latest 84 | name: pandoc to vimdoc 85 | steps: 86 | - uses: actions/checkout@v2 87 | - name: panvimdoc 88 | uses: kdheepak/panvimdoc@main 89 | with: 90 | vimdoc: __VIMDOC_PROJECT_NAME_HERE__ # Output vimdoc project name (required) 91 | # The following are all optional 92 | pandoc: "README.md" # Input pandoc file 93 | version: "NVIM v0.8.0" # Vim version number 94 | toc: true # Table of contents 95 | description: "" # Project description used in title (if empty, uses neovim version and current date) 96 | titledatepattern: "%Y %B %d" # Pattern for the date that used in the title 97 | demojify: false # Strip emojis from the vimdoc 98 | dedupsubheadings: true # Add heading to subheading anchor links to ensure that subheadings are unique 99 | treesitter: true # Use treesitter for highlighting codeblocks 100 | ignorerawblocks: true # Ignore raw html blocks in markdown when converting to vimdoc 101 | docmapping: false # Use h4 headers as mapping docs 102 | docmappingprojectname: true # Use project name in tag when writing mapping docs 103 | shiftheadinglevelby: 0 # Shift heading levels by specified number 104 | incrementheadinglevelby: 0 # Increment heading levels by specified number 105 | ``` 106 | 107 | The only required thing for you to do is to choose a `__VIMDOC_PROJECT_NAME_HERE__` appropriately. This is 108 | usually the name of the plugin or the documentation file without the `.txt` extension. For example, 109 | the following: 110 | 111 | ```yaml 112 | - name: panvimdoc 113 | uses: kdheepak/panvimdoc@main 114 | with: 115 | vimdoc: panvimdoc 116 | ``` 117 | 118 | will output a file `doc/panvimdoc.txt` and the vim help tag for it will be `panvimdoc` using the 119 | `main` branch of the repository. 120 | 121 | All the other options are optional. 122 | 123 | It is recommended to pin to an exact version so you can be confident that no surprises occur for you 124 | or your users. See for which version to use. 125 | Once you pick a version, you can pin it like so: 126 | 127 | ```yaml 128 | - name: panvimdoc 129 | uses: kdheepak/panvimdoc@vX.X.X 130 | ``` 131 | 132 | For an example of how this is used, see one of the following workflows: 133 | 134 | - [kdheepak/panvimdoc](./.github/workflows/panvimdoc.yml): [doc/panvimdoc.txt](./doc/panvimdoc.txt) 135 | - [kdheepak/tabline.nvim](https://github.com/kdheepak/tabline.nvim/blob/main/.github/workflows/ci.yml): 136 | [doc/tabline.txt](https://github.com/kdheepak/tabline.nvim/blob/main/doc/tabline.txt) 137 | 138 | Or see any of the packages here that depend on this action: 139 | 140 | 141 | ### Generating HTML using GitHub Actions 142 | 143 | If you are interested in making your vim plugin documentation available as a HTML page, check out 144 | [.github/workflows/docs.yml](./.github/workflows/docs.yml) file. 145 | 146 | You can find the Markdown file you are reading right now converted to HTML here: https://kdheepak.com/panvimdoc/ 147 | 148 | Here's an example: 149 | 150 | ```yml 151 | name: docs 152 | 153 | on: 154 | push: 155 | branches: main 156 | 157 | permissions: 158 | contents: write 159 | 160 | jobs: 161 | publish-gh-page: 162 | runs-on: ubuntu-latest 163 | steps: 164 | - name: checkout code 165 | uses: actions/checkout@v3 166 | - name: pandoc markdown to html 167 | uses: docker://pandoc/latex:3.1 168 | with: 169 | args: >- 170 | --katex --from markdown+tex_math_single_backslash --to html5+smart 171 | --template="./scripts/template.html5" --css="/panvimdoc/css/theme.css" 172 | --css="/panvimdoc/css/skylighting-solarized-theme.css" --toc --wrap=none --metadata 173 | title="panvimdoc" doc/panvimdoc.md --lua-filter=scripts/include-files.lua 174 | --lua-filter=scripts/skip-blocks.lua -t html -o public/index.html 175 | - name: deploy to GitHub pages 176 | uses: JamesIves/github-pages-deploy-action@v4 177 | with: 178 | branch: gh-pages 179 | folder: public 180 | ``` 181 | 182 | ### Using pre-commit locally 183 | 184 | [pre-commit](https://pre-commit.com/) lets you easily install and manage pre-commit hooks locally. 185 | 186 | Two hooks are available, differing only in the way dependencies are handled: 187 | 188 | - `panvimdoc-docker`: Requires a running Docker engine on your host. All other dependencies will be loaded inside the container. 189 | - `panvimdoc`: Runs in your local environment, so you have to make sure all dependencies of panvimdoc are installed 190 | (i.e., `pandoc v3.0.0` or greater) 191 | 192 | To use a hook, first install pre-commit. Then, add the following to your `.pre-commit-config.yaml` (here `panvimdoc-docker` is used): 193 | 194 | ```yaml 195 | - repo: 'https://github.com/kdheepak/panvimdoc' 196 | rev: v4.0.1 197 | hooks: 198 | - id: panvimdoc-docker 199 | args: 200 | - '--project-name' 201 | - 202 | ``` 203 | 204 | You can specify additional arguments to `panvimdoc.sh` using `args`. See the section below (or run `./panvimdoc.sh`) for the full list of arguments. 205 | 206 | To change the input file, modify the `files` field of the hook and supply the corresponding `--input-file` to `args`. In the example below, the hook will be triggered if any `.md` file changes: 207 | 208 | ```yaml 209 | - repo: 'https://github.com/kdheepak/panvimdoc' 210 | rev: v4.0.1 211 | hooks: 212 | - id: panvimdoc-docker 213 | files: ^.*\.md$ 214 | args: 215 | - '--project-name' 216 | - 217 | - '--input-file' 218 | - 219 | ``` 220 | 221 | ### Using it manually locally 222 | 223 | The `./panvimdoc.sh` script runs `pandoc` along with all the filters and custom output writer. 224 | 225 | ```bash 226 | $ ./panvimdoc.sh 227 | Usage: ./panvimdoc.sh --project-name PROJECT_NAME --input-file INPUT_FILE --vim-version VIM_VERSION --toc TOC --description DESCRIPTION --dedup-subheadings DEDUP_SUBHEADINGS --treesitter TREESITTER 228 | 229 | Arguments: 230 | --project-name: the name of the project 231 | --input-file: the input markdown file 232 | --vim-version: the version of Vim that the project is compatible with 233 | --toc: 'true' if the output should include a table of contents, 'false' otherwise 234 | --description: a project description used in title (if empty, uses neovim version and current date) 235 | --dedup-subheadings: 'true' if duplicate subheadings should be removed, 'false' otherwise 236 | --title-date-pattern: '%Y %B %d' a pattern for the date that used in the title 237 | --demojify: 'false' if emojis should not be removed, 'true' otherwise 238 | --treesitter: 'true' if the project uses Tree-sitter syntax highlighting, 'false' otherwise 239 | --ignore-rawblocks: 'true' if the project should ignore HTML raw blocks, 'false' otherwise 240 | --doc-mapping: 'true' if the project should use h4 headers as mapping docs, 'false' otherwise 241 | --doc-mapping-project-name: 'true' if tags generated for mapping docs contain project name, 'false' otherwise 242 | --shift-heading-level-by: 0 if you don't want to shift heading levels , n otherwise 243 | --increment-heading-level-by: 0 if don't want to increment the starting heading number, n otherwise 244 | ``` 245 | 246 | You will need `pandoc v3.0.0` or greater for this script to work. 247 | 248 | # Motivation 249 | 250 | Writing user-friendly documentation is important for every successful software project. This is 251 | particularly true when writing documentation for users in the world of vim plugins. 252 | 253 | The process of writing and maintaining this documentation can often be a cumbersome, time-consuming 254 | task. This project is aims to make that process a little bit easier by allowing anyone to write 255 | documentation in markdown (or any format Pandoc supports) and converting it to vimdoc automatically. 256 | This way, plugin authors will have to write documentation just once (for example, as part of the 257 | README of the project), and the vim documentation can be autogenerated. 258 | 259 | ## Rationale 260 | 261 | 1. **Simplicity**: Writing in Markdown is often more intuitive for developers. By converting from 262 | Markdown to vimdoc, authors can maintain the simplicity of Markdown while adhering to the vimdoc 263 | standards. 264 | 2. **Unified Documentation**: Plugin authors can write their documentation just once (such as in the 265 | project's README) and automatically generate vim documentation, ensuring consistency and saving 266 | time. 267 | 3. **Preserving Vim Features**: Vimdoc isn’t just plain text; it supports syntax highlighting, tags, 268 | links, and careful formatting using whitespace. It's essential to preserve these features when 269 | converting to ensure the quality and usefulness of the documentation. See 270 | or 271 | [`@nanotree`'s project](https://github.com/nanotee/vimdoc-notes) for more information. 272 | 4. **Leveraging Pandoc**: Unlike existing solutions, this project leverages Pandoc's wide range of 273 | features, including support for multiple Markdown flavors and easy-to-write custom filters in 274 | Lua. 275 | 5. **Interoperability**: The choice of Pandoc allows for enhanced flexibility, making it easier to 276 | extend functionality or even adapt the converter for other documentation formats in the future. 277 | 278 | ## Background 279 | 280 | Writing documentation in Markdown and converting it to vimdoc is not a novel idea. 281 | 282 | For example, [ibhagwan/ts-vimdoc.nvim](https://github.com/ibhagwan/ts-vimdoc.nvim) is an 283 | implementation a neovim treesitter based markdown to vimdoc converter that works fairly well. There 284 | are no dependencies except for the Markdown treesitter parser. It is neovim only but you can use 285 | this on github actions even for a vim plugin documentation. 286 | 287 | There's also [wincent/docvim](https://github.com/wincent/docvim) which is written in Haskell. 288 | Finally, there's [FooSoft/md2vim](https://github.com/FooSoft/md2vim) which is written in Go. 289 | 290 | However, none of these projects use Pandoc. Pandoc Markdown supports a wide number of features: See 291 | for more information. Most importantly, it supports a range of 292 | Markdown formats and flavors. And, Pandoc has filters and a custom output writer that can be 293 | configured in lua. Pandoc filters can extend the capability of Pandoc with minimal lua scripting, 294 | and these are very easy to write and maintain too. 295 | 296 | That means, with this project, you can write your Vim documentation in Markdown, RestructuredText, 297 | AsciiDoc, etc and convert it to VimDoc, PDF, Word, HTML etc. 298 | 299 | # Goals 300 | 301 | By offering a specification and reference implementation for converting Pandoc Markdown to vimdoc, 302 | this project aims to reduce friction in the documentation process for vim plugin authors. 303 | 304 | Here are the specific goals that guide this project: 305 | 306 | - **Readability**: The Markdown files must render correctly when presented as README files on 307 | platforms like GitHub, GitLab, or SourceHut. 308 | - **Web-Friendly HTML**: If converted to HTML using Pandoc, the Markdown files must be web-friendly 309 | and render appropriately. 310 | - **VimDoc Features**: The generated vim documentation must support essential features like links 311 | and tags. 312 | - **Aesthetically Pleasing**: The vim documentation must not only be functional but also visually 313 | pleasing in both vim and plain text files. This includes the appropriate use of columns and 314 | spacing. 315 | - **Guidelines**: While the format of built-in Vim documentation is a valuable reference, it is used 316 | as a guideline rather than a specification. 317 | 318 | # Features 319 | 320 | This project offers a comprehensive suite of features designed to streamline the conversion process 321 | from Markdown to vimdoc: 322 | 323 | - Automatically generates titles for vim documentation. 324 | - Creates a table of contents to enhance navigation within the document. 325 | - Automatically handles the generation of links and tags. 326 | - Maintains markdown syntax for tables, ensuring proper rendering. 327 | - Allows for manual control through raw vimdoc syntax where necessary. 328 | - Offers the ability to include multiple Markdown files, providing flexibility in documentation 329 | structure. 330 | 331 | # Specification 332 | 333 | The specification is described in [panvimdoc.md](./doc/panvimdoc.md) along with examples. The 334 | generated output is in [panvimdoc.txt](./doc/panvimdoc.txt). The reference implementation of the 335 | Pandoc lua filter is in [panvimdoc.lua](./scripts/panvimdoc.lua). See [panvimdoc.sh](./panvimdoc.sh) 336 | for how to use this script, or check the [Usage](#usage) section. 337 | 338 | 339 | 340 | If you would like to contribute to the specification, or if you have feature requests or opinions, 341 | please feel free to comment here: . 342 | 343 | 344 | 345 | # References 346 | 347 | - 348 | - 349 | - 350 | - 351 | - 352 | - 353 | 354 | # Donate 355 | 356 | If you've found this project helpful, you can show your appreciation by sponsoring me on [GitHub Sponsors](https://github.com/sponsors/kdheepak/) or [donating via Strip](https://donate.stripe.com/8wM9E7bBO9ZsbGUdQR). 357 | -------------------------------------------------------------------------------- /action.yaml: -------------------------------------------------------------------------------- 1 | # action.yml 2 | name: "panvimdoc" 3 | description: "Convert pandoc input to vimdoc output" 4 | branding: 5 | icon: file-text 6 | color: gray-dark 7 | inputs: 8 | vimdoc: 9 | description: "Output vimdoc project name" 10 | required: true 11 | pandoc: 12 | description: "Input pandoc file" 13 | required: true 14 | default: "README.md" 15 | version: 16 | description: "Vim version" 17 | required: false 18 | default: "NVIM v0.8.0" 19 | toc: 20 | description: "Table of contents" 21 | required: false 22 | default: "true" 23 | description: 24 | description: "Project description used in title (if empty, uses neovim version and current date)" 25 | required: false 26 | default: "" 27 | titledatepattern: 28 | description: "Pattern for the date that used in the title (if empty, uses '%Y %B %d')" 29 | required: false 30 | default: "%Y %B %d" 31 | demojify: 32 | description: "Strip emojis from the vimdoc" 33 | required: false 34 | default: "false" 35 | dedupsubheadings: 36 | description: "Add heading to subheading links" 37 | required: false 38 | default: "true" 39 | treesitter: 40 | description: "Use treesitter for highlighting codeblocks" 41 | required: false 42 | default: "true" 43 | ignorerawblocks: 44 | description: "Ignore raw blocks when generating vimdoc" 45 | required: false 46 | default: "true" 47 | docmapping: 48 | description: "Use h4 headers as mapping docs" 49 | required: false 50 | default: "false" 51 | docmappingprojectname: 52 | description: "Use project name in tag when writing mapping docs" 53 | required: false 54 | default: "true" 55 | shiftheadinglevelby: 56 | description: "Shift heading levels by specified number" 57 | required: false 58 | default: "0" 59 | incrementheadinglevelby: 60 | description: "Increment heading levels by specified number" 61 | required: false 62 | default: "0" 63 | runs: 64 | using: "docker" 65 | image: "Dockerfile" 66 | args: 67 | - --project-name 68 | - ${{ inputs.vimdoc }} 69 | - --input-file 70 | - ${{ inputs.pandoc }} 71 | - --vim-version 72 | - ${{ inputs.version }} 73 | - --toc 74 | - ${{ inputs.toc }} 75 | - --description 76 | - ${{ inputs.description }} 77 | - --title-date-pattern 78 | - ${{ inputs.titledatepattern }} 79 | - --dedup-subheadings 80 | - ${{ inputs.dedupsubheadings }} 81 | - --demojify 82 | - ${{ inputs.demojify }} 83 | - --treesitter 84 | - ${{ inputs.treesitter }} 85 | - --ignore-rawblocks 86 | - ${{ inputs.ignorerawblocks }} 87 | - --doc-mapping-project-name 88 | - ${{ inputs.docmappingprojectname }} 89 | - --doc-mapping 90 | - ${{ inputs.docmapping }} 91 | - --shift-heading-level-by 92 | - ${{ inputs.shiftheadinglevelby }} 93 | - --increment-heading-level-by 94 | - ${{ inputs.incrementheadinglevelby }} 95 | -------------------------------------------------------------------------------- /doc/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kdheepak/panvimdoc/1ae0cacf53d9f67329e12d90615c09e6979e8c39/doc/.gitkeep -------------------------------------------------------------------------------- /doc/panvimdoc.md: -------------------------------------------------------------------------------- 1 | ```{.include} 2 | README.md 3 | ``` 4 | 5 | # Specification 6 | 7 | See [./panvimdoc.txt](./panvimdoc.txt) for generated output of this file. 8 | 9 | ## External includes 10 | 11 | Use the following in your markdown file to include any other markdown file: 12 | 13 | ````markdown 14 | ```{.include} 15 | README.md 16 | ``` 17 | ```` 18 | 19 | The path of the file is with respect to the working directory where `pandoc` is executed. 20 | 21 | ## Codeblocks 22 | 23 | ``` 24 | Multi line Code blocks are indented 4 spaces and 25 | 26 | are formatted 27 | 28 | appropriately with > and <. 29 | ``` 30 | 31 | Alternatively, you can use `vimdoc` as the language for the code block to write raw text that will be inserted into the final document. 32 | 33 | For example, the following: 34 | 35 | ```` 36 | ```vimdoc 37 | You can use codeblocks that have language as `vimdoc` to write raw vimdoc. 38 | ``` 39 | ```` 40 | 41 | will be rendered verbatim in the generated documentation. 42 | 43 | 44 | 45 | e.g.: 46 | 47 | ```vimdoc 48 | You can use codeblocks that have language as `vimdoc` to write raw vimdoc. 49 | ``` 50 | 51 | 52 | 53 | This can be used to write any custom whitespace formatted documentation in the generated vimdoc (for mappings, options etc). 54 | 55 | # Title 56 | 57 | The first line of the documentation that is generated will look something like this: 58 | 59 | ``` 60 | *panvimdoc.txt* For VIM - Vi IMproved 8.1 Last change: 2021 August 11 61 | ``` 62 | 63 | # Heading 64 | 65 | Main headings are numbered. 66 | 67 | 68 | 69 | e.g.: 70 | 71 | ``` 72 | ============================================================================== 73 | 2. Heading *panvimdoc-heading* 74 | 75 | Main headings are numbered. 76 | ``` 77 | 78 | 79 | 80 | ## Sub Heading 2 81 | 82 | Sub headings are upper cased heading. 83 | 84 | 85 | 86 | e.g.: 87 | 88 | ``` 89 | SUB HEADING 2 *panvimdoc-sub-heading-2* 90 | 91 | Sub headings are upper cased heading. 92 | ``` 93 | 94 | 95 | 96 | Notice that both headings and subheadings have tags. 97 | 98 | ### Sub Heading 3 99 | 100 | Sub headings are upper cased, but do not have tags. They are also not included in the TOC. 101 | They are suffixed with ` ~` which highlights as **bold** text when the file is viewed on GitHub. 102 | 103 | ## Markdown Links 104 | 105 | You can use markdown links in vimdoc. 106 | 107 | 108 | 109 | The following markdown: 110 | 111 | 112 | 113 | ```markdown 114 | You can link to the tags by using [sub heading 2](#sub-heading-2). 115 | ``` 116 | 117 | 118 | 119 | is converted to the following vimdoc: 120 | 121 | ``` 122 | You can link to the tags by using |projectName-sub-heading-2|. 123 | ``` 124 | 125 | 126 | 127 | This way, any links will work in markdown README on GitHub or on the web using anchors AND will work as tags and links in vimdoc. 128 | The anchors are simply dropped in vimdoc inline. 129 | The onus is on the documentation writer to choose the correct anchor for the appropriate Markdown link. 130 | 131 | In vimdoc tags are created when anchors to the internal document are used. 132 | If the target is an external link, the link is inlined. 133 | 134 | If the external link is to the neovim documentation, an internal vim link is generated. For example: 135 | 136 | - [cursorcolumn](https://neovim.io/doc/user/options.html#'cursorcolumn') 137 | - [`completeopt`](https://neovim.io/doc/user/options.html#'completeopt') 138 | - [vim](https://github.com/vim/vim) 139 | - [neovim](https://github.com/neovim/neovim) 140 | 141 | 142 | 143 | The following is generated in vimdoc: 144 | 145 | ``` 146 | - |cursorcolumn| 147 | - |`completeopt`| 148 | - vim 149 | - neovim 150 | ``` 151 | 152 | 153 | 154 | This is excluded from the links section. 155 | 156 | Lastly, if the markdown text is a url, the link is not added to the links section and instead is placed inline. 157 | 158 | ## Linking to help tags 159 | 160 | Markdown doucments may suggest help tags via `:h help-tag`, which are converted to `|help-tag|` "hot links" in vimdoc. 161 | 162 | ## Mappings 163 | 164 | While you can use codeblocks with the language `vimdoc` to insert text in the generated vimdoc, it can be useful to have a markdown friendly way to write documentation for mappings. 165 | 166 | Pandoc supports definition lists: . 167 | This can be used to generate documentation of mappings. 168 | All of the content in curly braces `{...}` that is part of the header is dropped and a tag is created. 169 | 170 | For example, the following in a markdown file: 171 | 172 | ````markdown 173 | :FnlCompileBuffer 174 | 175 | : Compiles current active fennel buffer 176 | 177 | :FnlCompile[!] 178 | 179 | : Diff compiles all indexed fennel files 180 | If bang! is present then forcefully compiles all `source` files 181 | 182 | :Fnl {expr} 183 | 184 | : Executes and Evalutate {expr} of fennel 185 | 186 | ```fennel 187 | :Fnl (print "Hello World") 188 | 189 | :Fnl (values some_var) 190 | ``` 191 | 192 | Testing 193 | ```` 194 | 195 | becomes the following vimdoc: 196 | 197 | ``` 198 | 199 | *projectName-:FnlCompileBuffer* 200 | 201 | 202 | :FnlCompileBuffer Compiles current active fennel buffer 203 | 204 | 205 | *projectName-:FnlCompile* 206 | 207 | 208 | :FnlCompile[!] Diff compiles all indexed fennel files 209 | If bang! is present then forcefully compiles all `source` files 210 | 211 | 212 | *projectName-:Fnl* 213 | 214 | 215 | :Fnl {expr} Executes and Evalutate {expr} of fennel 216 | >fennel 217 | :Fnl (print "Hello World") 218 | 219 | :Fnl (values some_var) 220 | < 221 | Testing 222 | ``` 223 | 224 | Notice that the tag `*projectName-:Command*` is generated for you. Additionally, content in square brackets `[...]` or curly brackets `{...}` is also dropped for creating the tag name. 225 | 226 | i.e. the term `### :[range]Command` becomes the tag `*projectName-:Command*`. 227 | 228 | See following mappings as examples: 229 | 230 | 231 | 232 | pv{motion} 233 | 234 | : Command that operates over {motion} moved. 235 | 236 | 237 | 238 | The following vimdoc mapping is generated: 239 | 240 | ``` 241 | *panvimdoc-pv* 242 | 243 | 244 | pv{motion} Command that operates over {motion} moved. 245 | ``` 246 | 247 | 248 | 249 | pvd 250 | 251 | : Command that takes [count] lines. 252 | 253 | 254 | 255 | The following vimdoc mapping is generated: 256 | 257 | ``` 258 | *panvimdoc-pvd* 259 | 260 | 261 | pvd Command that takes [count] lines. 262 | ``` 263 | 264 | 265 | 266 | :[range]CommandName {doc=CommandName} 267 | 268 | : Command that operates over [range]. 269 | 270 | 271 | 272 | The following vimdoc mapping is generated: 273 | 274 | ``` 275 | *panvimdoc-:CommandName* 276 | 277 | 278 | :[range]CommandName {doc=CommandName} Command that operates over [range]. 279 | ``` 280 | 281 | 282 | 283 | {Visual}pv 284 | 285 | : Command that operates over highlighted lines. 286 | 287 | 288 | 289 | The following vimdoc mapping is generated: 290 | 291 | ``` 292 | *panvimdoc-pv* 293 | 294 | 295 | {Visual}pv Command that operates over highlighted lines. 296 | ``` 297 | 298 | 299 | 300 | 301 | 302 | ## Table 303 | 304 | Support for markdown tables is also available: 305 | 306 | 307 | 308 | | Option | Background | Default | Description | 309 | | ---------------------------------- | ---------- | ------- | ------------------------------------------------------------------------- | 310 | | lightness | light | `nil` | Change background colors lightness. Options: `'bright'`, `'dim'`. | 311 | | darkness | dark | `nil` | Change background colors darkness. Options: `'stark'`, `'warm'`. | 312 | | solid_vert_split | both | `false` | Solid \|hl-VertSplit\| background. | 313 | | solid_line_nr | both | `false` | Solid \|hl-LineNr\| background. | 314 | | solid_float_border | both | `false` | Make \|hl-FloatBorder\| have a more distinguishable background highlight. | 315 | | darken_noncurrent_window | light | `false` | Make non-current window background darker than _Normal_. | 316 | | lighten_noncurrent_window | dark | `false` | Make non-current window background lighter than _Normal_. | 317 | | italic_comments | both | `true` | Make comments italicize. | 318 | | darken_comments | light | `38` | Percentage to darken comments relative to Normal bg. | 319 | | lighten_comments | dark | `38` | Percentage to lighten comments relative to Normal bg. | 320 | | darken_non_text | light | `25` | Percentage to darken \|hl-NonText\| relative to Normal bg. | 321 | | lighten_non_text | dark | `30` | Percentage to lighten \|hl-NonText\| relative to Normal bg. | 322 | | darken_line_nr | light | `33` | Percentage to darken \|hl-LineNr\| relative to Normal bg. | 323 | | lighten_line_nr | dark | `35` | Percentage to lighten \|hl-LineNr\| relative to Normal bg. | 324 | | darken_cursor_line | light | `3` | Percentage to darken \|hl-CursorLine\| relative to Normal bg. | 325 | | lighten_cursor_line | dark | `4` | Percentage to lighten \|hl-CursorLine\| relative to Normal bg. | 326 | | colorize_diagnostic_underline_text | both | `false` | Colorize the fg of `DiagnosticUnderline*`. | 327 | | transparent_background | both | `false` | Make background transparent. | 328 | 329 | 330 | 331 | 332 | 333 | The following gets generated: 334 | 335 | ``` 336 | ----------------------------------------------------------------------------------------------------- 337 | Option Background Default Description 338 | ------------------------------------ ------------ --------- ----------------------------------------- 339 | lightness light nil Change background colors lightness. 340 | Options: 'bright', 'dim'. 341 | 342 | darkness dark nil Change background colors darkness. 343 | Options: 'stark', 'warm'. 344 | 345 | solid_vert_split both false Solid |hl-VertSplit| background. 346 | 347 | solid_line_nr both false Solid |hl-LineNr| background. 348 | 349 | solid_float_border both false Make |hl-FloatBorder| have a more 350 | distinguishable background highlight. 351 | 352 | darken_noncurrent_window light false Make non-current window background darker 353 | than Normal. 354 | 355 | lighten_noncurrent_window dark false Make non-current window background 356 | lighter than Normal. 357 | 358 | italic_comments both true Make comments italicize. 359 | 360 | darken_comments light 38 Percentage to darken comments relative to 361 | Normal bg. 362 | 363 | lighten_comments dark 38 Percentage to lighten comments relative 364 | to Normal bg. 365 | 366 | darken_non_text light 25 Percentage to darken |hl-NonText| 367 | relative to Normal bg. 368 | 369 | lighten_non_text dark 30 Percentage to lighten |hl-NonText| 370 | relative to Normal bg. 371 | 372 | darken_line_nr light 33 Percentage to darken |hl-LineNr| relative 373 | to Normal bg. 374 | 375 | lighten_line_nr dark 35 Percentage to lighten |hl-LineNr| 376 | relative to Normal bg. 377 | 378 | darken_cursor_line light 3 Percentage to darken |hl-CursorLine| 379 | relative to Normal bg. 380 | 381 | lighten_cursor_line dark 4 Percentage to lighten |hl-CursorLine| 382 | relative to Normal bg. 383 | 384 | colorize_diagnostic_underline_text both false Colorize the fg of DiagnosticUnderline*. 385 | 386 | transparent_background both false Make background transparent. 387 | ----------------------------------------------------------------------------------------------------- 388 | ``` 389 | 390 | 391 | 392 | ## Markdown only content 393 | 394 | Sometimes you want to show content that is to be present in Markdown and on the rendered view on GitHub but ignored in the generated vimdoc. 395 | This can be placed inside `panvimdoc-ignore-{start/end}` blocks: 396 | 397 | ``` 398 | 399 | 400 |
401 | Vimdoc Ignored Section 402 | 403 | This section will ignored when generating the vimdoc file. 404 | This will only show up in the Markdown file. 405 | 406 |
407 | 408 | 409 | ``` 410 | 411 | The following will only be present in the Markdown document. 412 | 413 | 414 | 415 |
416 | Vimdoc Ignored Section 417 | 418 | This section will ignored when generating the vimdoc file. 419 | This will only show up in the Markdown file. 420 | See the raw markdown of this file for examples. 421 | 422 |
423 | 424 | 425 | 426 | The convenient advantage of using `` blocks in a HTML comment syntax is that the comment will not rendered in HTML or on GitHub, giving the documentation writers control to present the information differently on GitHub and in vimdoc. 427 | If you want to see examples of this, see the raw markdown version of this file. 428 | 429 | The only thing to keep in mind is that you must leave new line spaces before and after a comment tag. For example, **do not** do this: 430 | 431 | ``` 432 | 433 | ![screenshot](./gif.gif) 434 | 435 | ``` 436 | 437 | because it may cause the rest of your document to be ignored. Do this instead: 438 | 439 | ``` 440 | 441 | 442 | ![screenshot](./gif.gif) 443 | 444 | 445 | ``` 446 | 447 | ## Vimdoc only content 448 | 449 | Inversely to [markdown only content](#markdown-only-content), sometimes you want to show content only present in Vimdoc and hidden when viewed on Github. 450 | 451 | This can be placed inside `panvimdoc-include-comment` comments. 452 | 453 | As with markdown only content, you must include a blank link before and after the comment. 454 | 455 | ```markdown 456 | 457 | 458 | 459 | 474 | 475 | ``` 476 | 477 | 478 | 479 | 487 | 488 | ## Details and summary 489 | 490 | You can even use `
` and `` tags for your README.md. 491 | 492 |
493 | 494 | Summary 495 | 496 | This section is the details. 497 | 498 |
499 | 500 | 501 | 502 | This gets rendered as: 503 | 504 | ``` 505 | Summary ~ 506 | 507 | This section is the details. 508 | ``` 509 | 510 | 511 | 512 | The `html` tags are dropped and the following output is generated in the vimdoc file. 513 | 514 | If you are using html ` ... ` tags, use them on new lines. Inline bold tags will have 515 | a ` ~` appended to the text and that may not be what you want. 516 | 517 | ## Keyboard HTML tag 518 | 519 | Use `CMD + o` in markdown, for example CMD + o. 520 | 521 | 522 | 523 | This gets rendered as: 524 | 525 | ``` 526 | Use `CMD + o` in markdown, for example CMD + o. 527 | ``` 528 | 529 | 530 | 531 | ## Examples 532 | 533 | First example 534 | 535 | ## Examples 536 | 537 | Second example 538 | 539 | ## Remove emojis 540 | 541 | ### :sparkles: Features 542 | 543 | ### :zap: Requirements 544 | 545 | ### :package: Installation 546 | 547 | 548 | 549 | This gets rendered as: 550 | 551 | `demoji: false`: 552 | 553 | ``` 554 | :SPARKLES: FEATURES ~ 555 | 556 | 557 | :ZAP: REQUIREMENTS ~ 558 | 559 | 560 | :PACKAGE: INSTALLATION ~ 561 | ``` 562 | 563 | OR 564 | 565 | `demoji: true`: 566 | 567 | ``` 568 | FEATURES ~ 569 | 570 | 571 | REQUIREMENTS ~ 572 | 573 | 574 | INSTALLATION ~ 575 | ``` 576 | 577 | 578 | -------------------------------------------------------------------------------- /justfile: -------------------------------------------------------------------------------- 1 | build: 2 | @./panvimdoc.sh "--project-name" "panvimdoc" "--input-file" "doc/panvimdoc.md" "--vim-version" "NVIM v0.8.0" "--toc" "true" "--description" "" "--title-date-pattern" "%Y %B %d" "--dedup-subheadings" "true" "--demojify" "false" "--treesitter" "true" "--ignore-rawblocks" "true" "--doc-mapping" "false" "--doc-mapping-project-name" "true" --shift-heading-level-by 0 --increment-heading-level-by 0 3 | 4 | test: 5 | julia --project -e 'using Pkg; Pkg.test()' 6 | -------------------------------------------------------------------------------- /lib/Demojify.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | Demojify.lua 3 | A function to strip emoji-like codepoints from strings. 4 | 5 | This module is licensed under MIT, review the LICENSE file or: 6 | https://github.com/buildthomas/Demojify/blob/master/LICENSE 7 | --]] 8 | 9 | local function lookupify(t) 10 | local r = {} 11 | for _, v in pairs(t) do 12 | r[v] = true 13 | end 14 | return r 15 | end 16 | 17 | -- All emoji-like codepoint ranges in UTF8 18 | local blockedRanges = { 19 | { 0x0001F601, 0x0001F64F }, 20 | { 0x00002702, 0x000027B0 }, 21 | { 0x0001F680, 0x0001F6C0 }, 22 | { 0x000024C2, 0x0001F251 }, 23 | { 0x0001F300, 0x0001F5FF }, 24 | { 0x00002194, 0x00002199 }, 25 | { 0x000023E9, 0x000023F3 }, 26 | { 0x000025FB, 0x000026FD }, 27 | { 0x0001F300, 0x0001F5FF }, 28 | { 0x0001F600, 0x0001F636 }, 29 | { 0x0001F681, 0x0001F6C5 }, 30 | { 0x0001F30D, 0x0001F567 }, 31 | -- unicode 8 32 | { 0x0001F980, 0x0001F984 }, 33 | { 0x0001F910, 0x0001F918 }, 34 | { 0x0001F6E0, 0x0001F6E5 }, 35 | -- unicode 9 36 | { 0x0001F920, 0x0001F927 }, 37 | { 0x0001F919, 0x0001F91E }, 38 | { 0x0001F933, 0x0001F93A }, 39 | { 0x0001F93C, 0x0001F93E }, 40 | { 0x0001F985, 0x0001F98F }, 41 | { 0x0001F940, 0x0001F94F }, 42 | { 0x0001F950, 0x0001F95F }, 43 | -- unicode 10 44 | { 0x0001F928, 0x0001F92F }, 45 | { 0x0001F9D0, 0x0001F9DF }, 46 | { 0x0001F9E0, 0x0001F9E6 }, 47 | { 0x0001F992, 0x0001F997 }, 48 | { 0x0001F960, 0x0001F96B }, 49 | -- unicode 11 50 | { 0x0001F9B0, 0x0001F9B9 }, 51 | { 0x0001F97C, 0x0001F97F }, 52 | { 0x0001F9F0, 0x0001F9FF }, 53 | { 0x0001F9E7, 0x0001F9EF }, 54 | -- unicode 12 55 | { 0x0001F7E0, 0x0001F7EB }, 56 | { 0x0001FA90, 0x0001FA95 }, 57 | { 0x0001F9A5, 0x0001F9AA }, 58 | { 0x0001F9BA, 0x0001F9BF }, 59 | { 0x0001F9C3, 0x0001F9CA }, 60 | { 0x0001FA70, 0x0001FA73 }, 61 | -- unicode 13 62 | { 0x0001F6D6, 0x0001F6D7 }, 63 | { 0x0001F6FB, 0x0001F6FC }, 64 | { 0x0001F977, 0x0001F978 }, 65 | { 0x0001F9A3, 0x0001F9A4 }, 66 | { 0x0001F9AB, 0x0001F9AD }, 67 | { 0x0001FA83, 0x0001FA86 }, 68 | { 0x0001FA96, 0x0001FAA8 }, 69 | { 0x0001FAB0, 0x0001FAB6 }, 70 | { 0x0001FAC0, 0x0001FAC2 }, 71 | { 0x0001FAD0, 0x0001FAD6 }, 72 | -- unicode 14 73 | { 0x0001F6DD, 0x0001F6DF }, 74 | { 0x0001FA7B, 0x0001FA7C }, 75 | { 0x0001FAA9, 0x0001FAAC }, 76 | { 0x0001FAB7, 0x0001FABA }, 77 | { 0x0001FAC3, 0x0001FAC5 }, 78 | { 0x0001FAD7, 0x0001FAD9 }, 79 | { 0x0001FAE0, 0x0001FAE7 }, 80 | { 0x0001FAF0, 0x0001FAF6 }, 81 | -- unicode 15 82 | { 0x0001FA75, 0x0001FA77 }, 83 | { 0x0001FA87, 0x0001FA88 }, 84 | { 0x0001FAAD, 0x0001FAAF }, 85 | { 0x0001FABB, 0x0001FABD }, 86 | { 0x0001FACE, 0x0001FACF }, 87 | { 0x0001FADA, 0x0001FADB }, 88 | { 0x0001FAF7, 0x0001FAF8 }, 89 | } 90 | 91 | -- Miscellaneous UTF8 codepoints that should be blocked 92 | local blockedSingles = lookupify({ 93 | 0x000000A9, 94 | 0x000000AE, 95 | 0x0000203C, 96 | 0x00002049, 97 | 0x000020E3, 98 | 0x00002122, 99 | 0x00002139, 100 | 0x000021A9, 101 | 0x000021AA, 102 | 0x0000231A, 103 | 0x0000231B, 104 | 0x000025AA, 105 | 0x000025AB, 106 | 0x000025B6, 107 | 0x000025C0, 108 | 0x00002934, 109 | 0x00002935, 110 | 0x00002B05, 111 | 0x00002B06, 112 | 0x00002B07, 113 | 0x00002B1B, 114 | 0x00002B1C, 115 | 0x00002B50, 116 | 0x00002B55, 117 | 0x00003030, 118 | 0x0000303D, 119 | 0x00003297, 120 | 0x00003299, 121 | 0x0001F004, 122 | 0x0001F0CF, 123 | -- unicode 7 124 | 0x0001F6F3, 125 | 0x0001F6F4, 126 | 0x0001F6E9, 127 | 0x0001F6F0, 128 | 0x0001F6CE, 129 | 0x0001F6CD, 130 | 0x0001F6CF, 131 | 0x0001F6CB, 132 | 0x00023F8, 133 | 0x00023F9, 134 | 0x00023FA, 135 | 0x0001F51F, 136 | -- unicode 8 137 | 0x0001F6CC, 138 | 0x0001F9C0, 139 | 0x0001F6EB, 140 | 0x0001F6EC, 141 | 0x0001F6D0, 142 | 0x00023CF, 143 | 0x000002A, 144 | 0x0002328, 145 | -- unicode 9 146 | 0x0001F5A4, 147 | 0x0001F471, 148 | 0x0001F64D, 149 | 0x0001F64E, 150 | 0x0001F645, 151 | 0x0001F646, 152 | 0x0001F681, 153 | 0x0001F64B, 154 | 0x0001F647, 155 | 0x0001F46E, 156 | 0x0001F575, 157 | 0x0001F582, 158 | 0x0001F477, 159 | 0x0001F473, 160 | 0x0001F930, 161 | 0x0001F486, 162 | 0x0001F487, 163 | 0x0001F6B6, 164 | 0x0001F3C3, 165 | 0x0001F57A, 166 | 0x0001F46F, 167 | 0x0001F3CC, 168 | 0x0001F3C4, 169 | 0x0001F6A3, 170 | 0x0001F3CA, 171 | 0x00026F9, 172 | 0x0001F3CB, 173 | 0x0001F6B5, 174 | 0x0001F6B5, 175 | 0x0001F468, 176 | 0x0001F469, 177 | 0x0001F990, 178 | 0x0001F991, 179 | 0x0001F6F5, 180 | 0x0001F6F4, 181 | 0x0001F6D1, 182 | 0x0001F6F6, 183 | 0x0001F6D2, 184 | 0x0002640, 185 | 0x0002642, 186 | 0x0002695, 187 | 0x0001F3F3, 188 | 0x0001F1FA, 189 | -- unicode 10 190 | 0x0001F91F, 191 | 0x0001F932, 192 | 0x0001F931, 193 | 0x0001F9F8, 194 | 0x0001F9F7, 195 | 0x0001F3F4, 196 | -- unicode 11 197 | 0x0001F970, 198 | 0x0001F973, 199 | 0x0001F974, 200 | 0x0001F97A, 201 | 0x0001F975, 202 | 0x0001F976, 203 | 0x0001F9B5, 204 | 0x0001F9B6, 205 | 0x0001F468, 206 | 0x0001F469, 207 | 0x0001F99D, 208 | 0x0001F999, 209 | 0x0001F99B, 210 | 0x0001F998, 211 | 0x0001F9A1, 212 | 0x0001F99A, 213 | 0x0001F99C, 214 | 0x0001F9A2, 215 | 0x0001F9A0, 216 | 0x0001F99F, 217 | 0x0001F96D, 218 | 0x0001F96C, 219 | 0x0001F96F, 220 | 0x0001F9C2, 221 | 0x0001F96E, 222 | 0x0001F99E, 223 | 0x0001F9C1, 224 | 0x0001F6F9, 225 | 0x0001F94E, 226 | 0x0001F94F, 227 | 0x0001F94D, 228 | 0x0000265F, 229 | 0x0000267E, 230 | 0x0001F3F4, 231 | -- unicode 12 232 | 0x0001F971, 233 | 0x0001F90E, 234 | 0x0001F90D, 235 | 0x0001F90F, 236 | 0x0001F9CF, 237 | 0x0001F9CD, 238 | 0x0001F9CE, 239 | 0x0001F468, 240 | 0x0001F469, 241 | 0x0001F9D1, 242 | 0x0001F91D, 243 | 0x0001F46D, 244 | 0x0001F46B, 245 | 0x0001F46C, 246 | 0x0001F9AE, 247 | 0x0001F415, 248 | 0x0001F6D5, 249 | 0x0001F6FA, 250 | 0x0001FA82, 251 | 0x0001F93F, 252 | 0x0001FA80, 253 | 0x0001FA81, 254 | 0x0001F97B, 255 | 0x0001F9AF, 256 | 0x0001FA78, 257 | 0x0001FA79, 258 | 0x0001FA7A, 259 | -- unicode 13 260 | 0x0001F90C, 261 | 0x0001F972, 262 | 0x0001F9CB, 263 | 0x0001FA74, 264 | 0x0000FE0F, 265 | 0x0001F3FB, 266 | 0x0001F3FC, 267 | 0x0001F3FD, 268 | 0x0001F3FE, 269 | 0x0001F3FF, 270 | -- unicode 14 271 | 0x0001F7F0, 272 | 0x0001F979, 273 | 0x0001F9CC, 274 | -- unicode 15 275 | 0x0001F6DC, 276 | 0x0001FABF, 277 | 0x0001FAE8, 278 | }) 279 | 280 | -- Demojify function 281 | return function(str) 282 | -- Array that will contain non-emoji codepoints in string 283 | local codepoints = {} 284 | 285 | -- Loop over codepoints in input 286 | for _, codepoint in utf8.codes(str) do 287 | -- Assume innocent until proven guilty 288 | local insert = true 289 | 290 | -- Check if singular blocked 291 | if blockedSingles[codepoint] then 292 | insert = false 293 | else 294 | -- Check all ranges 295 | for _, range in ipairs(blockedRanges) do 296 | if range[1] <= codepoint and codepoint <= range[2] then 297 | -- Codepoint is in an emoji range 298 | insert = false 299 | break 300 | end 301 | end 302 | end 303 | 304 | -- Only insert into table if proven non-emoji 305 | if insert then 306 | table.insert(codepoints, codepoint) 307 | end 308 | end 309 | 310 | -- Return string without emoji codepoints 311 | return utf8.char(table.unpack(codepoints)) 312 | end 313 | -------------------------------------------------------------------------------- /lib/init.lua: -------------------------------------------------------------------------------- 1 | -- add project root to lua package path so requires work when the cwd is not 2 | -- the project root 3 | package.path = PANDOC_STATE.user_data_dir .. "/../?.lua;" .. package.path 4 | -------------------------------------------------------------------------------- /panvimdoc.pre-commit.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | args=$# # number of command line args 3 | for (( i=1; i<=$args; i+=2 )) # loop from 1 to N (where N is number of args) 4 | do 5 | j=$((i + 1 )) 6 | if [ "${!i}" == "--project-name" ] ; then 7 | PROJECT_NAME="${!j}" 8 | break; 9 | fi 10 | done 11 | 12 | # extract project name to determine file location 13 | if [ -z "$PROJECT_NAME" ]; then 14 | echo "Error: argument --project-name is not set." 15 | exit 1 16 | fi 17 | # store hash to check whether documentation has changed 18 | if [ -f "doc/$PROJECT_NAME.txt" ]; then 19 | DOC_HASH_PRE="$(md5sum doc/$PROJECT_NAME.txt)" 20 | else 21 | DOC_HASH_PRE="" 22 | fi 23 | SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) 24 | source "$SCRIPT_DIR/panvimdoc.sh" 25 | DOC_HASH_POST="$(md5sum doc/$PROJECT_NAME.txt)" 26 | # send FAIL when doc has changed 27 | if [ "$DOC_HASH_PRE" != "$DOC_HASH_POST" ] ; then 28 | echo "" 29 | echo 'Updated documentation "doc/$PROJECT_NAME.txt"' 30 | echo 'Use "git add doc/$PROJECT_NAME.txt" to stage the changes' 31 | exit 1 32 | fi 33 | -------------------------------------------------------------------------------- /panvimdoc.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -euo pipefail 4 | 5 | # Check if the script was called with no arguments and show help in that case 6 | usage() { 7 | cat < code.sourceCode > span > a:first-child::before { 8 | color: #c1c7cd; 9 | } 10 | code { 11 | --paper-code-red: #c82829; 12 | --paper-code-orange: #ff5600; 13 | --paper-code-green: #718c00; 14 | --paper-code-blue: #21439c; 15 | --paper-code-cyan: #45899d; 16 | --paper-code-magenta: #a535ae; 17 | --paper-code-gray: #637282; 18 | } 19 | code span.im { color: var(--color-text); font-weight: normal; font-style: normal; } /* Import */ 20 | code span.bu { color: var(--color-text); font-weight: normal; font-style: normal; } /* BuiltIn */ 21 | code span.ex { color: var(--color-text); font-weight: normal; font-style: normal; } /* Extension */ 22 | code span.at { color: var(--color-text); font-weight: normal; font-style: normal; } /* Attribute */ 23 | code span.kw { color: var(--paper-code-orange); font-weight: normal; font-style: normal; } /* Keyword */ 24 | code span.dt { color: var(--paper-code-green); font-weight: normal; font-style: normal; } /* DataType */ 25 | code span.dv { color: var(--paper-code-blue); font-weight: normal; font-style: normal; } /* DecVal */ 26 | code span.bn { color: var(--paper-code-magenta); font-weight: normal; font-style: normal; } /* BaseN */ 27 | code span.fl { color: var(--paper-code-magenta); font-weight: normal; font-style: normal; } /* Float */ 28 | code span.ch { color: var(--paper-code-magenta); font-weight: normal; font-style: normal; } /* Char */ 29 | code span.st { color: var(--paper-code-green); font-weight: normal; font-style: normal; } /* String */ 30 | code span.vs { color: var(--paper-code-green); font-weight: normal; font-style: normal; } /* VerbatimString */ 31 | code span.co { color: var(--paper-code-gray); font-weight: normal; font-style: normal; } /* Comment */ 32 | code span.ot { color: var(--paper-code-blue); font-weight: normal; font-style: normal; } /* Other */ 33 | code span.al { color: var(--paper-code-red); font-weight: normal; font-style: normal; } /* Alert */ 34 | code span.fu { color: var(--paper-code-blue); font-weight: normal; font-style: normal; } /* Function */ 35 | code span.er { color: var(--paper-code-red); font-weight: normal; font-style: normal; } /* Error */ 36 | code span.wa { color: var(--paper-code-orange); font-weight: normal; font-style: italic; } /* Warning */ 37 | code span.cn { color: var(--paper-code-magenta); font-weight: normal; font-style: normal; } /* Constant */ 38 | code span.sc { color: var(--paper-code-red); font-weight: normal; font-style: normal; } /* SpecialChar */ 39 | code span.ss { color: var(--paper-code-red); font-weight: normal; font-style: normal; } /* SpecialString */ 40 | code span.va { color: var(--paper-code-blue); font-weight: normal; font-style: normal; } /* Variable */ 41 | code span.cf { color: var(--paper-code-orange); font-weight: normal; font-style: normal; } /* ControlFlow */ 42 | code span.op { color: var(--paper-code-orange); font-weight: normal; font-style: normal; } /* Operator */ 43 | code span.pp { color: var(--paper-code-cyan); font-weight: normal; font-style: normal; } /* Preprocessor */ 44 | code span.do { color: var(--paper-code-gray); font-weight: normal; font-style: italic; } /* Documentation */ 45 | code span.an { color: var(--paper-code-gray); font-weight: normal; font-style: italic; } /* Annotation */ 46 | code span.cv { color: var(--paper-code-gray); font-weight: normal; font-style: italic; } /* CommentVar */ 47 | code span.in { color: var(--paper-code-gray); font-weight: normal; font-style: italic; } /* Information */ 48 | a.sourceLine::before { text-decoration: none; } 49 | 50 | @media (prefers-color-scheme: dark) { 51 | pre, pre.numberSource { 52 | background-color: #242121; 53 | --color-code-highlight-bg: #322f2f; 54 | } 55 | pre.numberSource > code.sourceCode > span > a:first-child::before { 56 | color: #524f4d; 57 | } 58 | code { 59 | --paper-code-red: #9b0032; 60 | --paper-code-orange: #fa551e; 61 | --paper-code-green: #b4dc19; 62 | --paper-code-blue: #14c8eb; 63 | --paper-code-cyan: #14c8eb; 64 | --paper-code-magenta: #78286e; 65 | --paper-code-gray: #9d9b99; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /public/css/skylighting-solarized-theme.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --solarized-base03: #002b36; 3 | --solarized-base02: #073642; 4 | --solarized-base01: #586e75; 5 | --solarized-base00: #657b83; 6 | --solarized-base0: #839496; 7 | --solarized-base1: #93a1a1; 8 | --solarized-base2: #eee8d5; 9 | --solarized-base3: #fdf6e3; 10 | --solarized-yellow: #b58900; 11 | --solarized-orange: #cb4b16; 12 | --solarized-red: #dc322f; 13 | --solarized-magenta: #d33682; 14 | --solarized-violet: #6c71c4; 15 | --solarized-blue: #268bd2; 16 | --solarized-cyan: #2aa198; 17 | --solarized-green: #859900; 18 | } 19 | 20 | @media (prefers-color-scheme: dark) { 21 | :root { 22 | --solarized-base03: #fdf6e3; 23 | --solarized-base02: #eee8d5; 24 | --solarized-base01: #93a1a1; 25 | --solarized-base00: #839496; 26 | --solarized-base0: #657b83; 27 | --solarized-base1: #586e75; 28 | --solarized-base2: #073642; 29 | --solarized-base3: #002b36; 30 | } 31 | } 32 | 33 | pre, pre.numberSource { 34 | background: var(--solarized-base3); 35 | /* border: 1px solid var(--solarized-base2); */ 36 | --color-code-highlight-bg: var(--solarized-base2); 37 | } 38 | pre code { color: var(--solarized-base00); } 39 | pre.numberSource > code.sourceCode > span > a:first-child::before { 40 | color: var(--solarized-base1); 41 | } 42 | code span.kw { color: var(--solarized-green); font-weight: normal; font-style: normal; } /* Keyword */ 43 | code span.dt { color: var(--solarized-yellow); font-weight: normal; font-style: normal; } /* DataType */ 44 | code span.dv { color: var(--solarized-cyan); font-weight: normal; font-style: normal; } /* DecVal */ 45 | code span.bn { color: var(--solarized-cyan); font-weight: normal; font-style: normal; } /* BaseN */ 46 | code span.fl { color: var(--solarized-cyan); font-weight: normal; font-style: normal; } /* Float */ 47 | code span.ch { color: var(--solarized-cyan); font-weight: normal; font-style: normal; } /* Char */ 48 | code span.st { color: var(--solarized-cyan); font-weight: normal; font-style: normal; } /* String */ 49 | code span.co { color: var(--solarized-base1); font-weight: normal; font-style: italic; } /* Comment */ 50 | code span.ot { color: var(--solarized-blue); font-weight: normal; font-style: normal; } /* Other */ 51 | code span.al { color: var(--solarized-red); font-weight: normal; font-style: normal; } /* Alert */ 52 | code span.fu { color: var(--solarized-blue); font-weight: normal; font-style: normal; } /* Function */ 53 | code span.er { color: var(--solarized-red); font-weight: normal; font-style: normal; } /* Error */ 54 | code span.wa { color: var(--solarized-orange); font-weight: normal; font-style: italic; } /* Warning */ 55 | code span.cn { color: var(--solarized-cyan); font-weight: normal; font-style: normal; } /* Constant */ 56 | code span.sc { color: var(--solarized-red); font-weight: normal; font-style: normal; } /* SpecialChar */ 57 | code span.vs { color: var(--solarized-cyan); font-weight: normal; font-style: normal; } /* VerbatimString */ 58 | code span.ss { color: var(--solarized-red); font-weight: normal; font-style: normal; } /* SpecialString */ 59 | code span.im { color: var(--solarized-base00); font-weight: normal; font-style: normal; } /* Import */ 60 | code span.va { color: var(--solarized-blue); font-weight: normal; font-style: normal; } /* Variable */ 61 | code span.cf { color: var(--solarized-green); font-weight: normal; font-style: normal; } /* ControlFlow */ 62 | code span.op { color: var(--solarized-green); font-weight: normal; font-style: normal; } /* Operator */ 63 | code span.bu { color: var(--solarized-base00); font-weight: normal; font-style: normal; } /* BuiltIn */ 64 | code span.ex { color: var(--solarized-base00); font-weight: normal; font-style: normal; } /* Extension */ 65 | code span.pp { color: var(--solarized-orange); font-weight: normal; font-style: normal; } /* Preprocessor */ 66 | code span.at { color: var(--solarized-base00); font-weight: normal; font-style: normal; } /* Attribute */ 67 | code span.do { color: var(--solarized-base1); font-weight: normal; font-style: italic; } /* Documentation */ 68 | code span.an { color: var(--solarized-base1); font-weight: normal; font-style: italic; } /* Annotation */ 69 | code span.cv { color: var(--solarized-base1); font-weight: normal; font-style: italic; } /* CommentVar */ 70 | code span.in { color: var(--solarized-base1); font-weight: normal; font-style: italic; } /* Information */ 71 | a.sourceLine::before { text-decoration: none; } 72 | 73 | /* pandoc diff mode */ 74 | code.diff span.kw { color: var(--solarized-yellow); font-weight: normal; font-style: normal; } /* --- lines */ 75 | code.diff span.dt { color: var(--solarized-blue); font-weight: normal; font-style: normal; } /* +++ lines, @@ ... @@ lines */ 76 | code.diff span.st { color: var(--solarized-red); font-weight: normal; font-style: normal; } /* - lines */ 77 | code.diff span.va { color: var(--solarized-green); font-weight: normal; font-style: normal; } /* + lines */ 78 | -------------------------------------------------------------------------------- /public/css/tufte.css: -------------------------------------------------------------------------------- 1 | /* ----- @font-face rules ---------------------------------------------- {{{ */ 2 | /* BEGIN Taken from tufte-css */ 3 | 4 | /** 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2014 Dave Liepmann 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in all 17 | * copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | */ 27 | 28 | /* Import ET Book styles 29 | adapted from https://github.com/edwardtufte/et-book/blob/gh-pages/et-book.css */ 30 | 31 | @font-face { font-family: "et-book"; 32 | src: url("../fonts/et-book/et-book-roman-line-figures/et-book-roman-line-figures.eot"); 33 | src: url("../fonts/et-book/et-book-roman-line-figures/et-book-roman-line-figures.eot?#iefix") format("embedded-opentype"), url("../fonts/et-book/et-book-roman-line-figures/et-book-roman-line-figures.woff") format("woff"), url("../fonts/et-book/et-book-roman-line-figures/et-book-roman-line-figures.ttf") format("truetype"), url("../fonts/et-book/et-book-roman-line-figures/et-book-roman-line-figures.svg#etbookromanosf") format("svg"); 34 | font-weight: normal; 35 | font-style: normal; } 36 | 37 | @font-face { font-family: "et-book"; 38 | src: url("../fonts/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.eot"); 39 | src: url("../fonts/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.eot?#iefix") format("embedded-opentype"), url("../fonts/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.woff") format("woff"), url("../fonts/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.ttf") format("truetype"), url("../fonts/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.svg#etbookromanosf") format("svg"); 40 | font-weight: normal; 41 | font-style: italic; } 42 | 43 | @font-face { font-family: "et-book"; 44 | src: url("../fonts/et-book/et-book-bold-line-figures/et-book-bold-line-figures.eot"); 45 | src: url("../fonts/et-book/et-book-bold-line-figures/et-book-bold-line-figures.eot?#iefix") format("embedded-opentype"), url("../fonts/et-book/et-book-bold-line-figures/et-book-bold-line-figures.woff") format("woff"), url("../fonts/et-book/et-book-bold-line-figures/et-book-bold-line-figures.ttf") format("truetype"), url("../fonts/et-book/et-book-bold-line-figures/et-book-bold-line-figures.svg#etbookromanosf") format("svg"); 46 | font-weight: bold; 47 | font-style: normal; } 48 | 49 | @font-face { font-family: "et-book-roman-old-style"; 50 | src: url("../fonts/et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.eot"); 51 | src: url("../fonts/et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.eot?#iefix") format("embedded-opentype"), url("../fonts/et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.woff") format("woff"), url("../fonts/et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.ttf") format("truetype"), url("../fonts/et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.svg#etbookromanosf") format("svg"); 52 | font-weight: normal; 53 | font-style: normal; } 54 | 55 | /* END Taken from tufte-css */ 56 | 57 | /* }}} */ 58 | 59 | :root { 60 | /* --- Colors --- */ 61 | 62 | --background-color: #fffff8; 63 | 64 | --color-text: #111; 65 | --color-text-secondary: #111; 66 | --color-link: inherit; 67 | --color-sidenote: #111; 68 | 69 | --color-inline-code: #111; 70 | --color-inline-code-bg: rgba(0, 0, 0, 0); 71 | 72 | /* TODO(jez) Double check these colors */ 73 | --color-border: rgba(0, 0, 0, 0); 74 | --color-border-heavy: #000; 75 | 76 | /* TODO(jez) Make tables look more like tufte-pandoc-css */ 77 | --color-table-heading: var(--background-color); 78 | 79 | /* --- Text --- */ 80 | 81 | --font-family-prose: et-book, Palatino, "Palatino Linotype", "Palatino LT STD", "Book Antiqua", Georgia, serif; 82 | --font-family-heading: var(--font-family-prose); 83 | --font-family-code: Consolas, "Liberation Mono", Menlo, Courier, monospace; 84 | --side-note-number-font-family: et-book-roman-old-style, Palatino, Georgia, serif; 85 | 86 | --line-height: 30px; 87 | --font-size: 21px; 88 | 89 | --inline-code-font-size: 16px; 90 | --code-block-font-size: 15px; 91 | --line-numbers-font-size: 13px; 92 | 93 | --side-note-line-height: 24px; 94 | --side-note-font-size: 16px; 95 | --side-note-code-font-size: 12px; 96 | --side-note-baseline-offset: 4.5px; 97 | --side-note-text-indent: -8px; 98 | 99 | --heading-font-weight: 400; 100 | 101 | --title-font-size: 48px; 102 | --title-code-font-size: 39px; 103 | --title-line-height: 48px; 104 | --title-margin-top: 90px; 105 | 106 | --h1-font-size: 33px; 107 | --h1-code-font-size: 27px; 108 | --h1-line-height: 33px; 109 | --h1-margin-top: 60px; 110 | --h1-margin-bottom: 21px; 111 | 112 | --h2-font-size: 26px; 113 | --h2-code-font-size: 20px; 114 | --h2-line-height: 26px; 115 | --h2-margin-top: 60px; 116 | --h2-margin-bottom: 21px; 117 | 118 | --figcaption-line-height: 24px; 119 | --figcaption-font-size: 18px; 120 | --figcaption-code-font-size: 14px; 121 | --figcaption-gap: 7px; 122 | --captioned-figure-gap: 12px; 123 | 124 | --table-line-height: 26px; 125 | --table-font-size: 21px; 126 | --table-code-font-size: 16px; 127 | 128 | --nav-toc-font-size: 15px; 129 | --nav-toc-code-font-size: 12px; 130 | --nav-toc-indent: 16px; 131 | } 132 | 133 | @media (prefers-color-scheme: dark) { 134 | :root { 135 | --background-color: #111; 136 | 137 | --color-text: #fffff8; 138 | --color-text-secondary: #fffff8; 139 | --color-link: inherit; 140 | --color-sidenote: #fffff8; 141 | 142 | --color-inline-code: #fffff8; 143 | --color-inline-code-bg: inherit; 144 | 145 | --color-border: inherit; 146 | --color-border-heavy: #fff; 147 | } 148 | } 149 | 150 | h1:not(.title), h2 { 151 | font-style: italic; 152 | } 153 | 154 | nav#TOC label 155 | a, a:link, a:visited { 156 | text-decoration: underline; 157 | } 158 | 159 | @media screen and (min-width: calc(745px + 2 * (52px + 206px + 52px) - 1px)) { 160 | nav#TOC a { 161 | text-decoration: none; 162 | } 163 | nav#TOC a:hover, 164 | nav#TOC a:hover code { 165 | text-decoration: underline; 166 | } 167 | } 168 | 169 | table { 170 | border-width: 2px; 171 | } 172 | 173 | table, table td, table th { 174 | border-left: none; 175 | border-right: none; 176 | } 177 | 178 | table td { 179 | border-top: none; 180 | border-bottom: none; 181 | } 182 | 183 | table td, table th { 184 | min-width: 120px; 185 | } 186 | -------------------------------------------------------------------------------- /public/fonts/atlas-grotesk/AtlasGrotesk-Bold-190618-Web.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kdheepak/panvimdoc/1ae0cacf53d9f67329e12d90615c09e6979e8c39/public/fonts/atlas-grotesk/AtlasGrotesk-Bold-190618-Web.woff2 -------------------------------------------------------------------------------- /public/fonts/atlas-grotesk/AtlasGrotesk-BoldItalic-190618-Web.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kdheepak/panvimdoc/1ae0cacf53d9f67329e12d90615c09e6979e8c39/public/fonts/atlas-grotesk/AtlasGrotesk-BoldItalic-190618-Web.woff2 -------------------------------------------------------------------------------- /public/fonts/atlas-grotesk/AtlasGrotesk-Medium-190618-Web.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kdheepak/panvimdoc/1ae0cacf53d9f67329e12d90615c09e6979e8c39/public/fonts/atlas-grotesk/AtlasGrotesk-Medium-190618-Web.woff2 -------------------------------------------------------------------------------- /public/fonts/atlas-grotesk/AtlasGrotesk-MediumItalic-190618-Web.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kdheepak/panvimdoc/1ae0cacf53d9f67329e12d90615c09e6979e8c39/public/fonts/atlas-grotesk/AtlasGrotesk-MediumItalic-190618-Web.woff2 -------------------------------------------------------------------------------- /public/fonts/atlas-grotesk/AtlasGrotesk-Regular-190618-Web.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kdheepak/panvimdoc/1ae0cacf53d9f67329e12d90615c09e6979e8c39/public/fonts/atlas-grotesk/AtlasGrotesk-Regular-190618-Web.woff2 -------------------------------------------------------------------------------- /public/fonts/atlas-grotesk/AtlasGrotesk-RegularItalic-190618-Web.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kdheepak/panvimdoc/1ae0cacf53d9f67329e12d90615c09e6979e8c39/public/fonts/atlas-grotesk/AtlasGrotesk-RegularItalic-190618-Web.woff2 -------------------------------------------------------------------------------- /public/fonts/atlas-grotesk/AtlasGrotesk-Semi-190618-Web.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kdheepak/panvimdoc/1ae0cacf53d9f67329e12d90615c09e6979e8c39/public/fonts/atlas-grotesk/AtlasGrotesk-Semi-190618-Web.woff2 -------------------------------------------------------------------------------- /public/fonts/atlas-grotesk/AtlasGrotesk-SemiItalic-190618-Web.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kdheepak/panvimdoc/1ae0cacf53d9f67329e12d90615c09e6979e8c39/public/fonts/atlas-grotesk/AtlasGrotesk-SemiItalic-190618-Web.woff2 -------------------------------------------------------------------------------- /public/fonts/et-book/et-book-bold-line-figures/et-book-bold-line-figures.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kdheepak/panvimdoc/1ae0cacf53d9f67329e12d90615c09e6979e8c39/public/fonts/et-book/et-book-bold-line-figures/et-book-bold-line-figures.eot -------------------------------------------------------------------------------- /public/fonts/et-book/et-book-bold-line-figures/et-book-bold-line-figures.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kdheepak/panvimdoc/1ae0cacf53d9f67329e12d90615c09e6979e8c39/public/fonts/et-book/et-book-bold-line-figures/et-book-bold-line-figures.ttf -------------------------------------------------------------------------------- /public/fonts/et-book/et-book-bold-line-figures/et-book-bold-line-figures.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kdheepak/panvimdoc/1ae0cacf53d9f67329e12d90615c09e6979e8c39/public/fonts/et-book/et-book-bold-line-figures/et-book-bold-line-figures.woff -------------------------------------------------------------------------------- /public/fonts/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kdheepak/panvimdoc/1ae0cacf53d9f67329e12d90615c09e6979e8c39/public/fonts/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.eot -------------------------------------------------------------------------------- /public/fonts/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kdheepak/panvimdoc/1ae0cacf53d9f67329e12d90615c09e6979e8c39/public/fonts/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.ttf -------------------------------------------------------------------------------- /public/fonts/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kdheepak/panvimdoc/1ae0cacf53d9f67329e12d90615c09e6979e8c39/public/fonts/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.woff -------------------------------------------------------------------------------- /public/fonts/et-book/et-book-roman-line-figures/et-book-roman-line-figures.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kdheepak/panvimdoc/1ae0cacf53d9f67329e12d90615c09e6979e8c39/public/fonts/et-book/et-book-roman-line-figures/et-book-roman-line-figures.eot -------------------------------------------------------------------------------- /public/fonts/et-book/et-book-roman-line-figures/et-book-roman-line-figures.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kdheepak/panvimdoc/1ae0cacf53d9f67329e12d90615c09e6979e8c39/public/fonts/et-book/et-book-roman-line-figures/et-book-roman-line-figures.ttf -------------------------------------------------------------------------------- /public/fonts/et-book/et-book-roman-line-figures/et-book-roman-line-figures.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kdheepak/panvimdoc/1ae0cacf53d9f67329e12d90615c09e6979e8c39/public/fonts/et-book/et-book-roman-line-figures/et-book-roman-line-figures.woff -------------------------------------------------------------------------------- /public/fonts/et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kdheepak/panvimdoc/1ae0cacf53d9f67329e12d90615c09e6979e8c39/public/fonts/et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.eot -------------------------------------------------------------------------------- /public/fonts/et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kdheepak/panvimdoc/1ae0cacf53d9f67329e12d90615c09e6979e8c39/public/fonts/et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.ttf -------------------------------------------------------------------------------- /public/fonts/et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kdheepak/panvimdoc/1ae0cacf53d9f67329e12d90615c09e6979e8c39/public/fonts/et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.woff -------------------------------------------------------------------------------- /public/fonts/et-book/et-book-semi-bold-old-style-figures/et-book-semi-bold-old-style-figures.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kdheepak/panvimdoc/1ae0cacf53d9f67329e12d90615c09e6979e8c39/public/fonts/et-book/et-book-semi-bold-old-style-figures/et-book-semi-bold-old-style-figures.eot -------------------------------------------------------------------------------- /public/fonts/et-book/et-book-semi-bold-old-style-figures/et-book-semi-bold-old-style-figures.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kdheepak/panvimdoc/1ae0cacf53d9f67329e12d90615c09e6979e8c39/public/fonts/et-book/et-book-semi-bold-old-style-figures/et-book-semi-bold-old-style-figures.ttf -------------------------------------------------------------------------------- /public/fonts/et-book/et-book-semi-bold-old-style-figures/et-book-semi-bold-old-style-figures.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kdheepak/panvimdoc/1ae0cacf53d9f67329e12d90615c09e6979e8c39/public/fonts/et-book/et-book-semi-bold-old-style-figures/et-book-semi-bold-old-style-figures.woff -------------------------------------------------------------------------------- /public/fonts/source-code-pro/SourceCodePro-Bold-2030.otf.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kdheepak/panvimdoc/1ae0cacf53d9f67329e12d90615c09e6979e8c39/public/fonts/source-code-pro/SourceCodePro-Bold-2030.otf.woff2 -------------------------------------------------------------------------------- /public/fonts/source-code-pro/SourceCodePro-BoldIt-1050.otf.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kdheepak/panvimdoc/1ae0cacf53d9f67329e12d90615c09e6979e8c39/public/fonts/source-code-pro/SourceCodePro-BoldIt-1050.otf.woff2 -------------------------------------------------------------------------------- /public/fonts/source-code-pro/SourceCodePro-It-1050.otf.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kdheepak/panvimdoc/1ae0cacf53d9f67329e12d90615c09e6979e8c39/public/fonts/source-code-pro/SourceCodePro-It-1050.otf.woff2 -------------------------------------------------------------------------------- /public/fonts/source-code-pro/SourceCodePro-Regular-2030.otf.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kdheepak/panvimdoc/1ae0cacf53d9f67329e12d90615c09e6979e8c39/public/fonts/source-code-pro/SourceCodePro-Regular-2030.otf.woff2 -------------------------------------------------------------------------------- /public/img/dark-desktop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kdheepak/panvimdoc/1ae0cacf53d9f67329e12d90615c09e6979e8c39/public/img/dark-desktop.png -------------------------------------------------------------------------------- /public/img/dark-mobile-responsive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kdheepak/panvimdoc/1ae0cacf53d9f67329e12d90615c09e6979e8c39/public/img/dark-mobile-responsive.png -------------------------------------------------------------------------------- /public/img/dark-mobile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kdheepak/panvimdoc/1ae0cacf53d9f67329e12d90615c09e6979e8c39/public/img/dark-mobile.png -------------------------------------------------------------------------------- /public/img/el-capitan-from-four-mile-trail.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kdheepak/panvimdoc/1ae0cacf53d9f67329e12d90615c09e6979e8c39/public/img/el-capitan-from-four-mile-trail.jpg -------------------------------------------------------------------------------- /public/img/light-desktop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kdheepak/panvimdoc/1ae0cacf53d9f67329e12d90615c09e6979e8c39/public/img/light-desktop.png -------------------------------------------------------------------------------- /public/img/light-mobile-responsive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kdheepak/panvimdoc/1ae0cacf53d9f67329e12d90615c09e6979e8c39/public/img/light-mobile-responsive.png -------------------------------------------------------------------------------- /public/img/light-mobile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kdheepak/panvimdoc/1ae0cacf53d9f67329e12d90615c09e6979e8c39/public/img/light-mobile.png -------------------------------------------------------------------------------- /public/img/sugarloaf-hill-forest-green.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kdheepak/panvimdoc/1ae0cacf53d9f67329e12d90615c09e6979e8c39/public/img/sugarloaf-hill-forest-green.jpg -------------------------------------------------------------------------------- /public/img/sugarloaf-hill-forest-green@3x.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kdheepak/panvimdoc/1ae0cacf53d9f67329e12d90615c09e6979e8c39/public/img/sugarloaf-hill-forest-green@3x.jpg -------------------------------------------------------------------------------- /public/img/sugarloaf-hill-trail-april-june.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kdheepak/panvimdoc/1ae0cacf53d9f67329e12d90615c09e6979e8c39/public/img/sugarloaf-hill-trail-april-june.jpg -------------------------------------------------------------------------------- /public/img/sugarloaf-hill-trail-april-june@2x.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kdheepak/panvimdoc/1ae0cacf53d9f67329e12d90615c09e6979e8c39/public/img/sugarloaf-hill-trail-april-june@2x.jpg -------------------------------------------------------------------------------- /public/img/upper-crystal-springs-reservoir-facing-northwest.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kdheepak/panvimdoc/1ae0cacf53d9f67329e12d90615c09e6979e8c39/public/img/upper-crystal-springs-reservoir-facing-northwest.jpg -------------------------------------------------------------------------------- /public/img/upper-crystal-springs-reservoir-facing-southwest.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kdheepak/panvimdoc/1ae0cacf53d9f67329e12d90615c09e6979e8c39/public/img/upper-crystal-springs-reservoir-facing-southwest.jpg -------------------------------------------------------------------------------- /scripts/include-files.lua: -------------------------------------------------------------------------------- 1 | --- include-files.lua – filter to include Markdown files 2 | --- 3 | --- Copyright: © 2019–2021 Albert Krewinkel 4 | --- License: MIT – see LICENSE file for details 5 | -- Module pandoc.path is required and was added in version 2.12 6 | PANDOC_VERSION:must_be_at_least("3.0") 7 | 8 | local List = require("pandoc.List") 9 | local path = require("pandoc.path") 10 | local system = require("pandoc.system") 11 | 12 | function P(s) 13 | require("scripts.logging").temp(s) 14 | end 15 | 16 | --- Get include auto mode 17 | local include_auto = false 18 | function get_vars(meta) 19 | if meta["include-auto"] then 20 | include_auto = true 21 | end 22 | end 23 | 24 | --- Keep last heading level found 25 | local last_heading_level = 0 26 | function update_last_level(header) 27 | last_heading_level = header.level 28 | end 29 | 30 | --- Update contents of included file 31 | local function update_contents(blocks, shift_by, include_path) 32 | local update_contents_filter = { 33 | -- Shift headings in block list by given number 34 | Header = function(header) 35 | if shift_by then 36 | header.level = header.level + shift_by 37 | end 38 | return header 39 | end, 40 | -- If image paths are relative then prepend include file path 41 | Image = function(image) 42 | if path.is_relative(image.src) then 43 | image.src = path.normalize(path.join({ include_path, image.src })) 44 | end 45 | return image 46 | end, 47 | -- Update path for include-code-files.lua filter style CodeBlocks 48 | CodeBlock = function(cb) 49 | if cb.attributes.include and path.is_relative(cb.attributes.include) then 50 | cb.attributes.include = path.normalize(path.join({ include_path, cb.attributes.include })) 51 | end 52 | return cb 53 | end, 54 | } 55 | return pandoc.walk_block(pandoc.Div(blocks), update_contents_filter).content 56 | end 57 | 58 | --- Filter function for code blocks 59 | local transclude 60 | function transclude(cb) 61 | -- ignore code blocks which are not of class "include". 62 | if not cb.classes:includes("include") then 63 | return 64 | end 65 | 66 | -- Markdown is used if this is nil. 67 | local format = cb.attributes["format"] 68 | 69 | -- Attributes shift headings 70 | local shift_heading_level_by = 0 71 | local shift_input = cb.attributes["shift-heading-level-by"] 72 | if shift_input then 73 | shift_heading_level_by = tonumber(shift_input) 74 | else 75 | if include_auto then 76 | -- Auto shift headings 77 | shift_heading_level_by = last_heading_level 78 | end 79 | end 80 | 81 | --- keep track of level before recusion 82 | local buffer_last_heading_level = last_heading_level 83 | 84 | local blocks = List:new() 85 | for line in cb.text:gmatch("[^\n]+") do 86 | if line:sub(1, 2) ~= "//" then 87 | -- local fh = io.open(pandoc.system.get_working_directory() .. line) 88 | local mt, includecontents = pandoc.mediabag.fetch(line) 89 | if not includecontents then 90 | io.stderr:write("Cannot open file " .. line .. " | Skipping includes\n") 91 | else 92 | local contents = pandoc.read(includecontents, format).blocks 93 | last_heading_level = 0 94 | -- recursive transclusion 95 | contents = system.with_working_directory(path.directory(line), function() 96 | return pandoc.walk_block(pandoc.Div(contents), { Header = update_last_level, CodeBlock = transclude }) 97 | end).content 98 | --- reset to level before recursion 99 | last_heading_level = buffer_last_heading_level 100 | blocks:extend(update_contents(contents, shift_heading_level_by, path.directory(line))) 101 | -- fh:close() 102 | end 103 | end 104 | end 105 | return blocks 106 | end 107 | 108 | return { { Meta = get_vars }, { Header = update_last_level, CodeBlock = transclude } } 109 | -------------------------------------------------------------------------------- /scripts/logging.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | logging.lua: pandoc-aware logging functions (can also be used standalone) 3 | Copyright: (c) 2022 William Lupton 4 | License: MIT - see LICENSE file for details 5 | Usage: See README.md for details 6 | ]] 7 | 8 | -- if running standalone, create a 'pandoc' global 9 | if not pandoc then 10 | _G.pandoc = { utils = {} } 11 | end 12 | 13 | -- if there's no pandoc.utils, create a local one 14 | if not pcall(require, "pandoc.utils") then 15 | pandoc.utils = {} 16 | end 17 | 18 | -- if there's no pandoc.utils.type, create a local one 19 | if not pandoc.utils.type then 20 | pandoc.utils.type = function(value) 21 | local typ = type(value) 22 | if not ({ table = 1, userdata = 1 })[typ] then 23 | -- unchanged 24 | elseif value.__name then 25 | typ = value.__name 26 | elseif value.tag and value.t then 27 | typ = value.tag 28 | if typ:match("^Meta.") then 29 | typ = typ:sub(5) 30 | end 31 | if typ == "Map" then 32 | typ = "table" 33 | end 34 | end 35 | return typ 36 | end 37 | end 38 | 39 | -- namespace 40 | local logging = {} 41 | 42 | -- helper function to return a sensible typename 43 | logging.type = function(value) 44 | -- this can return 'Inlines', 'Blocks', 'Inline', 'Block' etc., or 45 | -- anything that built-in type() can return, namely 'nil', 'number', 46 | -- 'string', 'boolean', 'table', 'function', 'thread', or 'userdata' 47 | local typ = pandoc.utils.type(value) 48 | 49 | -- it seems that it can also return strings like 'pandoc Row'; replace 50 | -- spaces with periods 51 | -- XXX I'm not sure that this is done consistently, e.g. I don't think 52 | -- it's done for pandoc.Attr or pandoc.List? 53 | typ = typ:gsub(" ", ".") 54 | 55 | -- map Inline and Block to the tag name 56 | -- XXX I guess it's intentional that it doesn't already do this? 57 | return ({ Inline = 1, Block = 1 })[typ] and value.tag or typ 58 | end 59 | 60 | -- derived from https://www.lua.org/pil/19.3.html pairsByKeys() 61 | logging.spairs = function(list, comp) 62 | local keys = {} 63 | for key, _ in pairs(list) do 64 | table.insert(keys, tostring(key)) 65 | end 66 | table.sort(keys, comp) 67 | local i = 0 68 | local iter = function() 69 | i = i + 1 70 | return keys[i] and keys[i], list[keys[i]] or nil 71 | end 72 | return iter 73 | end 74 | 75 | -- helper function to dump a value with a prefix (recursive) 76 | -- XXX should detect repetition/recursion 77 | -- XXX would like maxlen logic to apply at all levels? but not trivial 78 | local function dump_(prefix, value, maxlen, level, add) 79 | local buffer = {} 80 | if prefix == nil then 81 | prefix = "" 82 | end 83 | if level == nil then 84 | level = 0 85 | end 86 | if add == nil then 87 | add = function(item) 88 | table.insert(buffer, item) 89 | end 90 | end 91 | local indent = maxlen and "" or (" "):rep(level) 92 | 93 | -- get typename, mapping to pandoc tag names where possible 94 | local typename = logging.type(value) 95 | 96 | -- don't explicitly indicate 'obvious' typenames 97 | local typ = (({ boolean = 1, number = 1, string = 1, table = 1, userdata = 1 })[typename] and "" or typename) 98 | 99 | -- light userdata is just a pointer (can't iterate over it) 100 | -- XXX is there a better way of checking for light userdata? 101 | if type(value) == "userdata" and not pcall(pairs(value)) then 102 | value = tostring(value):gsub("userdata:%s*", "") 103 | 104 | -- modify the value heuristically 105 | elseif ({ table = 1, userdata = 1 })[type(value)] then 106 | local valueCopy, numKeys, lastKey = {}, 0, nil 107 | for key, val in pairs(value) do 108 | -- pandoc >= 2.15 includes 'tag', nil values and functions 109 | if key ~= "tag" and val and type(val) ~= "function" then 110 | valueCopy[key] = val 111 | numKeys = numKeys + 1 112 | lastKey = key 113 | end 114 | end 115 | if numKeys == 0 then 116 | -- this allows empty tables to be formatted on a single line 117 | value = typename == "Space" and "" or "{}" 118 | elseif numKeys == 1 and lastKey == "text" then 119 | -- this allows text-only types to be formatted on a single line 120 | typ = typename 121 | value = value[lastKey] 122 | typename = "string" 123 | else 124 | value = valueCopy 125 | end 126 | end 127 | 128 | -- output the possibly-modified value 129 | local presep = #prefix > 0 and " " or "" 130 | local typsep = #typ > 0 and " " or "" 131 | local valtyp = type(value) 132 | if valtyp == "nil" then 133 | add("nil") 134 | elseif ({ boolean = 1, number = 1, string = 1 })[valtyp] then 135 | typsep = #typ > 0 and valtyp == "string" and #value > 0 and " " or "" 136 | -- don't use the %q format specifier; doesn't work with multi-bytes 137 | local quo = typename == "string" and "\"" or "" 138 | add(string.format("%s%s%s%s%s%s%s%s", indent, prefix, presep, typ, typsep, quo, value, quo)) 139 | -- light userdata is just a pointer (can't iterate over it) 140 | -- XXX is there a better way of checking for light userdata? 141 | elseif valtyp == "userdata" and not pcall(pairs(value)) then 142 | add(string.format("%s%s%s%s %s", indent, prefix, presep, typ, tostring(value):gsub("userdata:%s*", ""))) 143 | elseif ({ table = 1, userdata = 1 })[valtyp] then 144 | add(string.format("%s%s%s%s%s{", indent, prefix, presep, typ, typsep)) 145 | -- Attr and Attr.attributes have both numeric and string keys, so 146 | -- ignore the numeric ones 147 | -- XXX this is no longer the case for pandoc >= 2.15, so could remove 148 | -- the special case? 149 | local first = true 150 | if prefix ~= "attributes:" and typ ~= "Attr" then 151 | for i, val in ipairs(value) do 152 | local pre = maxlen and not first and ", " or "" 153 | local text = dump_(string.format("%s[%s]", pre, i), val, maxlen, level + 1, add) 154 | first = false 155 | end 156 | end 157 | -- report keys in alphabetical order to ensure repeatability 158 | for key, val in logging.spairs(value) do 159 | -- pandoc >= 2.15 includes 'tag' 160 | if not tonumber(key) and key ~= "tag" then 161 | local pre = maxlen and not first and ", " or "" 162 | local text = dump_(string.format("%s%s:", pre, key), val, maxlen, level + 1, add) 163 | end 164 | first = false 165 | end 166 | add(string.format("%s}", indent)) 167 | end 168 | return table.concat(buffer, maxlen and "" or "\n") 169 | end 170 | 171 | logging.dump = function(value, maxlen) 172 | if maxlen == nil then 173 | maxlen = 70 174 | end 175 | local text = dump_(nil, value, maxlen) 176 | if #text > maxlen then 177 | text = dump_(nil, value, nil) 178 | end 179 | return text 180 | end 181 | 182 | logging.output = function(...) 183 | local need_newline = false 184 | for i, item in ipairs({ ... }) do 185 | -- XXX space logic could be cleverer, e.g. no space after newline 186 | local maybe_space = i > 1 and " " or "" 187 | local text = ({ table = 1, userdata = 1 })[type(item)] and logging.dump(item) or tostring(item) 188 | io.stderr:write(maybe_space, text) 189 | need_newline = text:sub(-1) ~= "\n" 190 | end 191 | if need_newline then 192 | io.stderr:write("\n") 193 | end 194 | end 195 | 196 | -- basic logging support (-1=errors, 0=warnings, 1=info, 2=debug, 3=debug2) 197 | -- XXX should support string levels? 198 | logging.loglevel = 0 199 | 200 | -- set log level and return the previous level 201 | logging.setloglevel = function(loglevel) 202 | local oldlevel = logging.loglevel 203 | logging.loglevel = loglevel 204 | return oldlevel 205 | end 206 | 207 | -- verbosity default is WARNING; --quiet -> ERROR and --verbose -> INFO 208 | -- --trace sets TRACE or DEBUG (depending on --verbose) 209 | if type(PANDOC_STATE) == "nil" then 210 | -- use the default level 211 | elseif PANDOC_STATE.trace then 212 | logging.loglevel = PANDOC_STATE.verbosity == "INFO" and 3 or 2 213 | elseif PANDOC_STATE.verbosity == "INFO" then 214 | logging.loglevel = 1 215 | elseif PANDOC_STATE.verbosity == "WARNING" then 216 | logging.loglevel = 0 217 | elseif PANDOC_STATE.verbosity == "ERROR" then 218 | logging.loglevel = -1 219 | end 220 | 221 | logging.error = function(...) 222 | if logging.loglevel >= -1 then 223 | logging.output("(E)", ...) 224 | end 225 | end 226 | 227 | logging.warning = function(...) 228 | if logging.loglevel >= 0 then 229 | logging.output("(W)", ...) 230 | end 231 | end 232 | 233 | logging.info = function(...) 234 | if logging.loglevel >= 1 then 235 | logging.output("(I)", ...) 236 | end 237 | end 238 | 239 | logging.debug = function(...) 240 | if logging.loglevel >= 2 then 241 | logging.output("(D)", ...) 242 | end 243 | end 244 | 245 | logging.debug2 = function(...) 246 | if logging.loglevel >= 3 then 247 | logging.warning("debug2() is deprecated; use trace()") 248 | logging.output("(D2)", ...) 249 | end 250 | end 251 | 252 | logging.trace = function(...) 253 | if logging.loglevel >= 3 then 254 | logging.output("(T)", ...) 255 | end 256 | end 257 | 258 | -- for temporary unconditional debug output 259 | logging.temp = function(...) 260 | logging.output("(#)", ...) 261 | end 262 | 263 | return logging 264 | -------------------------------------------------------------------------------- /scripts/panvimdoc.lua: -------------------------------------------------------------------------------- 1 | PANDOC_VERSION:must_be_at_least("3.0") 2 | 3 | local pipe = pandoc.pipe 4 | local stringify = (require("pandoc.utils")).stringify 5 | local text = pandoc.text 6 | 7 | function P(s) 8 | require("scripts.logging").temp(s) 9 | end 10 | 11 | -- custom writer for pandoc 12 | 13 | local unpack = unpack or table.unpack 14 | local format = string.format 15 | local stringify = pandoc.utils.stringify 16 | local layout = pandoc.layout 17 | local to_roman = pandoc.utils.to_roman_numeral 18 | 19 | function string.starts_with(str, starts) 20 | return str:sub(1, #starts) == starts 21 | end 22 | 23 | function string.ends_with(str, ends) 24 | return ends == "" or str:sub(-#ends) == ends 25 | end 26 | 27 | local function empty(s) 28 | return s == nil or #s == 0 29 | end 30 | 31 | -- Character escaping 32 | local function escape(s, in_attribute) 33 | return s 34 | end 35 | 36 | local function indent(s, fl, ol) 37 | local ret = {} 38 | local i = 1 39 | for l in s:gmatch("[^\r\n]+") do 40 | if i == 1 then 41 | ret[i] = fl .. l 42 | else 43 | ret[i] = ol .. l 44 | end 45 | i = i + 1 46 | end 47 | return table.concat(ret, "\n") 48 | end 49 | 50 | Writer = pandoc.scaffolding.Writer 51 | 52 | local function inlines(ils) 53 | local buff = {} 54 | for i = 1, #ils do 55 | local el = ils[i] 56 | buff[#buff + 1] = Writer[pandoc.utils.type(el)][el.tag](el) 57 | end 58 | return table.concat(buff) 59 | end 60 | 61 | local function blocks(bs, sep) 62 | local dbuff = {} 63 | for i = 1, #bs do 64 | local el = bs[i] 65 | dbuff[#dbuff + 1] = Writer[pandoc.utils.type(el)][el.tag](el) 66 | end 67 | return table.concat(dbuff, sep) 68 | end 69 | 70 | local PROJECT = "" 71 | local TREESITTER = false 72 | local TOC = false 73 | local VIMVERSION = "0.9.0" 74 | local DESCRIPTION = "" 75 | local DEDUP_SUBHEADINGS = false 76 | local IGNORE_RAWBLOCKS = true 77 | local DOC_MAPPING = true 78 | local DOC_MAPPING_PROJECT = true 79 | local DATE = nil 80 | local TITLE_DATE_PATTERN = "%Y %B %d" 81 | 82 | local CURRENT_HEADER = nil 83 | local SOFTBREAK_TO_HARDBREAK = "space" 84 | 85 | local HEADER_COUNT = 1 86 | local toc = {} 87 | local links = {} 88 | 89 | local function osExecute(cmd) 90 | local fileHandle = assert(io.popen(cmd, "r")) 91 | local commandOutput = assert(fileHandle:read("*a")) 92 | local returnTable = { fileHandle:close() } 93 | return commandOutput, returnTable[3] -- rc[3] contains returnCode 94 | end 95 | 96 | local function renderTitle() 97 | local t = {} 98 | local function add(s) 99 | table.insert(t, s) 100 | end 101 | local vim_doc_title = PROJECT .. ".txt" 102 | local vim_doc_title_tag = "*" .. vim_doc_title .. "*" 103 | local project_description = DESCRIPTION or "" 104 | if empty(project_description) then 105 | local vim_version = VIMVERSION 106 | if empty(vim_version) then 107 | vim_version = osExecute("nvim --version"):gmatch("([^\n]*)\n?")() 108 | if string.find(vim_version, "-dev") then 109 | vim_version = string.gsub(vim_version, "(.*)-dev.*", "%1") 110 | end 111 | if empty(vim_version) then 112 | vim_version = osExecute("vim --version"):gmatch("([^\n]*)\n?")() 113 | vim_version = string.gsub(vim_version, "(.*) %(.*%)", "%1") 114 | end 115 | if empty(vim_version) then 116 | vim_version = "vim" 117 | end 118 | elseif vim_version == "vim" then 119 | vim_version = osExecute("vim --version"):gmatch("([^\n]*)\n?")() 120 | end 121 | 122 | local date = DATE 123 | if date == nil then 124 | date = os.date(TITLE_DATE_PATTERN) 125 | end 126 | local m = "For " .. vim_version 127 | local r = "Last change: " .. date 128 | local n = math.max(0, 78 - #vim_doc_title_tag - #m - #r) 129 | local s = string.rep(" ", math.floor(n / 2)) 130 | project_description = s .. m .. s .. r 131 | end 132 | local padding_len = math.max(0, 78 - #vim_doc_title_tag - #project_description) 133 | add(vim_doc_title_tag .. string.rep(" ", padding_len) .. project_description) 134 | add("") 135 | return table.concat(t, "\n") 136 | end 137 | 138 | local function renderToc() 139 | if TOC then 140 | local t = {} 141 | local function add(s) 142 | table.insert(t, s) 143 | end 144 | add(string.rep("=", 78)) 145 | local l = "Table of Contents" 146 | local tag = "*" .. PROJECT .. "-" .. string.gsub(string.lower(l), "%s", "-") .. "*" 147 | add(l .. string.rep(" ", 78 - #l - #tag) .. tag) 148 | add("") 149 | for _, elem in pairs(toc) do 150 | local level, item, link = elem[1], elem[2], elem[3] 151 | if level == 1 then 152 | local padding = string.rep(" ", 78 - #item - #link) 153 | add(item .. padding .. link) 154 | elseif level == 2 then 155 | local padding = string.rep(" ", 74 - #item - #link) 156 | add(" - " .. item .. padding .. link) 157 | end 158 | end 159 | add("") 160 | return table.concat(t, "\n") 161 | else 162 | return "" 163 | end 164 | end 165 | 166 | local function renderNotes() 167 | local t = {} 168 | local function add(s) 169 | table.insert(t, s) 170 | end 171 | if #links > 0 then 172 | local left = HEADER_COUNT .. ". Links" 173 | local right = "links" 174 | local right_link = string.format("|%s-%s|", PROJECT, right) 175 | right = string.format("*%s-%s*", PROJECT, right) 176 | local padding = string.rep(" ", 78 - #left - #right) 177 | table.insert(toc, { 1, left, right_link }) 178 | add(string.rep("=", 78) .. "\n" .. string.format("%s%s%s", left, padding, right)) 179 | add("") 180 | for i, v in ipairs(links) do 181 | add(i .. ". *" .. v.caption .. "*" .. ": " .. v.src) 182 | end 183 | end 184 | return table.concat(t, "\n") .. "\n" 185 | end 186 | 187 | local function renderFooter() 188 | return [[Generated by panvimdoc 189 | 190 | vim:tw=78:ts=8:noet:ft=help:norl:]] 191 | end 192 | 193 | Writer.Pandoc = function(doc, opts) 194 | PROJECT = doc.meta.project 195 | TREESITTER = doc.meta.treesitter 196 | TOC = doc.meta.toc 197 | VIMVERSION = doc.meta.vimversion 198 | DESCRIPTION = doc.meta.description 199 | DEDUP_SUBHEADINGS = doc.meta.dedupsubheadings 200 | IGNORE_RAWBLOCKS = doc.meta.ignorerawblocks 201 | DOC_MAPPING = doc.meta.docmapping 202 | DOC_MAPPING_PROJECT = doc.meta.docmappingproject 203 | HEADER_COUNT = HEADER_COUNT + doc.meta.incrementheadinglevelby 204 | DATE = doc.meta.date 205 | TITLE_DATE_PATTERN = doc.meta.titledatepattern 206 | local d = blocks(doc.blocks) 207 | local notes = renderNotes() 208 | local toc = renderToc() 209 | local title = renderTitle() 210 | local footer = renderFooter() 211 | return { title, layout.blankline, toc, d, notes, layout.blankline, footer } 212 | end 213 | 214 | Writer.Block.Header = function(el) 215 | local lev = el.level 216 | local s = stringify(el) 217 | local attr = el.attr 218 | local left, right, right_link, padding 219 | if lev == 1 then 220 | left = string.format("%d. %s", HEADER_COUNT, s) 221 | right = string.lower(string.gsub(s, "%s", "-")) 222 | CURRENT_HEADER = right 223 | right_link = string.format("|%s-%s|", PROJECT, right) 224 | right = string.format("*%s-%s*", PROJECT, right) 225 | padding = string.rep(" ", 78 - #left - #right) 226 | table.insert(toc, { 1, left, right_link }) 227 | s = string.format("%s%s%s", left, padding, right) 228 | HEADER_COUNT = HEADER_COUNT + 1 229 | s = string.rep("=", 78) .. "\n" .. s 230 | return "\n" .. s .. "\n\n" 231 | end 232 | if lev == 2 then 233 | left = string.upper(s) 234 | right = string.lower(string.gsub(s, "%s", "-")) 235 | if DEDUP_SUBHEADINGS and CURRENT_HEADER then 236 | right_link = string.format("|%s-%s-%s|", PROJECT, CURRENT_HEADER, right) 237 | right = string.format("*%s-%s-%s*", PROJECT, CURRENT_HEADER, right) 238 | else 239 | right_link = string.format("|%s-%s|", PROJECT, right) 240 | right = string.format("*%s-%s*", PROJECT, right) 241 | end 242 | padding = string.rep(" ", 78 - #left - #right) 243 | table.insert(toc, { 2, s, right_link }) 244 | s = string.format("%s%s%s", left, padding, right) 245 | return "\n" .. s .. "\n\n" 246 | end 247 | if lev == 3 then 248 | left = string.upper(s) 249 | return "\n" .. left .. " ~" .. "\n\n" 250 | end 251 | if lev == 4 then 252 | if DOC_MAPPING then 253 | left = s 254 | if attr.attributes.doc then 255 | right = "*" .. attr.attributes.doc .. "*" 256 | elseif DOC_MAPPING_PROJECT then 257 | -- stylua: ignore 258 | right = string.format( 259 | "*%s-%s*", 260 | PROJECT, 261 | s:gsub("{.+}", "") 262 | :gsub("%[.+%]", "") 263 | :gsub("^%s*(.-)%s*$", "%1") 264 | :gsub("^%s*(.-)%s*$", "%1") 265 | :gsub("%s", "-") 266 | ) 267 | else 268 | -- stylua: ignore 269 | right = string.format( 270 | "*%s*", 271 | s:gsub("{.+}", "") 272 | :gsub("%[.+%]", "") 273 | :gsub("^%s*(.-)%s*$", "%1") 274 | :gsub("^%s*(.-)%s*$", "%1") 275 | :gsub("%s", "-") 276 | ) 277 | end 278 | padding = string.rep(" ", 78 - #left - #right) 279 | local r = string.format("%s%s%s", left, padding, right) 280 | return "\n" .. r .. "\n\n" 281 | else 282 | left = string.upper(s) 283 | return "\n" .. left .. "\n\n" 284 | end 285 | end 286 | if lev >= 5 then 287 | left = string.upper(s) 288 | return "\n" .. left .. "\n\n" 289 | end 290 | end 291 | 292 | Writer.Block.Para = function(el) 293 | local s = inlines(el.content) 294 | local t = {} 295 | local current_line = "" 296 | for word in string.gmatch(s, "([^%s]+)") do 297 | if string.match(word, "[.]") and #word == 1 then 298 | current_line = current_line .. word 299 | elseif (#current_line + #word) > 78 then 300 | table.insert(t, current_line) 301 | current_line = word 302 | elseif #current_line == 0 then 303 | current_line = word 304 | else 305 | current_line = current_line .. " " .. word 306 | end 307 | end 308 | table.insert(t, current_line) 309 | return table.concat(t, "\n") .. "\n\n" 310 | end 311 | 312 | Writer.Block.OrderedList = function(items) 313 | local buffer = {} 314 | local i = 1 315 | items.content:map(function(item) 316 | table.insert(buffer, ("%s. %s"):format(i, blocks(item))) 317 | i = i + 1 318 | end) 319 | return table.concat(buffer, "\n") .. "\n\n" 320 | end 321 | 322 | Writer.Block.BulletList = function(items) 323 | local buffer = {} 324 | items.content:map(function(item) 325 | table.insert(buffer, indent(blocks(item, "\n"), "- ", " ")) 326 | end) 327 | return table.concat(buffer, "\n") .. "\n\n" 328 | end 329 | 330 | Writer.Block.DefinitionList = function(el) 331 | local buffer = {} 332 | local function add(s) 333 | table.insert(buffer, s) 334 | end 335 | el.content:map(function(item) 336 | local k = inlines(item[1]) 337 | local bs = item[2][1] 338 | local t = {} 339 | for i = 1, #bs do 340 | local e = bs[i] 341 | if e.tag == "Para" then 342 | local tt = {} 343 | e.content:map(function(i) 344 | if i.tag == "SoftBreak" then 345 | table.insert(tt, "\n") 346 | else 347 | table.insert(tt, Writer[pandoc.utils.type(i)][i.tag](i)) 348 | end 349 | end) 350 | table.insert(t, table.concat(tt)) 351 | else 352 | table.insert(t, Writer[pandoc.utils.type(e)][e.tag](e)) 353 | end 354 | end 355 | local str = table.concat(t, "\n") 356 | local i = 1 357 | 358 | local right = "" 359 | if DOC_MAPPING_PROJECT then 360 | -- stylua: ignore 361 | right = string.format( 362 | "*%s-%s*", 363 | PROJECT, 364 | k:gsub("{.+}", "") 365 | :gsub("%[.+%]", "") 366 | :gsub("^%s*(.-)%s*$", "%1") 367 | :gsub("^%s*(.-)%s*$", "%1") 368 | :gsub("%s", "-") 369 | ) 370 | else 371 | -- stylua: ignore 372 | right = string.format( 373 | "*%s*", 374 | k:gsub("{.+}", "") 375 | :gsub("%[.+%]", "") 376 | :gsub("^%s*(.-)%s*$", "%1") 377 | :gsub("^%s*(.-)%s*$", "%1") 378 | :gsub("%s", "-") 379 | ) 380 | end 381 | add(string.rep(" ", 78 - #right - 2) .. right) 382 | add("\n") 383 | for s in str:gmatch("[^\r\n]+") do 384 | if i == 1 then 385 | add(k .. string.rep(" ", 78 - 40 + 1 - #k) .. s) 386 | else 387 | add(string.rep(" ", 78 - 40 + 1) .. s) 388 | end 389 | i = i + 1 390 | end 391 | add("\n") 392 | end) 393 | return "\n" .. table.concat(buffer, "\n") .. "\n\n" 394 | end 395 | 396 | Writer.Block.CodeBlock = function(el) 397 | local attr = el.attr 398 | local s = el.text 399 | if #attr.classes > 0 and attr.classes[1] == "vimdoc" then 400 | return s .. "\n\n" 401 | else 402 | local lang = "" 403 | if TREESITTER and #attr.classes > 0 then 404 | lang = attr.classes[1] 405 | end 406 | local t = {} 407 | for line in s:gmatch("([^\n]*)\n?") do 408 | table.insert(t, " " .. escape(line)) 409 | end 410 | return ">" .. lang .. "\n" .. table.concat(t, "\n") .. "\n<\n\n" 411 | end 412 | end 413 | 414 | Writer.Inline.Str = function(el) 415 | local s = stringify(el) 416 | if string.starts_with(s, "(http") and string.ends_with(s, ")") then 417 | return " <" .. string.sub(s, 2, #s - 2) .. ">" 418 | else 419 | return escape(s) 420 | end 421 | end 422 | 423 | Writer.Inline.Space = function() 424 | return " " 425 | end 426 | 427 | Writer.Inline.SoftBreak = function() 428 | if SOFTBREAK_TO_HARDBREAK == "newline" then 429 | return "\n" 430 | elseif SOFTBREAK_TO_HARDBREAK == "space" then 431 | return "\n" 432 | else 433 | return "" 434 | end 435 | end 436 | 437 | Writer.Inline.LineBreak = function() 438 | return "\n" 439 | end 440 | 441 | Writer.Inline.Emph = function(s) 442 | return "_" .. stringify(s) .. "_" 443 | end 444 | 445 | Writer.Inline.Strong = function(s) 446 | return "**" .. stringify(s) .. "**" 447 | end 448 | 449 | Writer.Inline.Subscript = function(s) 450 | return "_" .. stringify(s) 451 | end 452 | 453 | Writer.Inline.Superscript = function(s) 454 | return "^" .. stringify(s) 455 | end 456 | 457 | Writer.Inline.SmallCaps = function(s) 458 | return stringify(s) 459 | end 460 | 461 | Writer.Inline.Strikeout = function(s) 462 | return "~" .. stringify(s) .. "~" 463 | end 464 | 465 | Writer.Inline.Link = function(el) 466 | local s = inlines(el.content) 467 | local tgt = el.target 468 | local tit = el.title 469 | local attr = el.attr 470 | if string.starts_with(tgt, "https://neovim.io/doc/") then 471 | return "|" .. s .. "|" 472 | elseif string.starts_with(tgt, "#") then 473 | return "|" .. PROJECT .. "-" .. s:lower():gsub("%s", "-") .. "|" 474 | elseif string.starts_with(s, "http") then 475 | return "<" .. s .. ">" 476 | else 477 | return s .. " <" .. tgt .. ">" 478 | end 479 | end 480 | 481 | Writer.Inline.Image = function(el) 482 | links[#links + 1] = { caption = inlines(el.caption), src = el.src } 483 | end 484 | 485 | Writer.Inline.Code = function(el) 486 | local content = stringify(el) 487 | local vim_help = string.match(content, "^:h %s*([^%s]+)") 488 | if vim_help then 489 | return string.format("|%s|", escape(vim_help)) 490 | else 491 | return "`" .. escape(content) .. "`" 492 | end 493 | end 494 | 495 | Writer.Inline.Math = function(s) 496 | return "`" .. escape(stringify(s)) .. "`" 497 | end 498 | 499 | Writer.Inline.Quoted = function(el) 500 | if el.quotetype == "DoubleQuote" then 501 | return "\"" .. inlines(el.content) .. "\"" 502 | else 503 | return "'" .. inlines(el.content) .. "'" 504 | end 505 | end 506 | 507 | Writer.Inline.Note = function(el) 508 | return stringify(el) 509 | end 510 | 511 | Writer.Inline.Null = function(s) 512 | return "" 513 | end 514 | 515 | Writer.Inline.Span = function(el) 516 | return inlines(el.content) 517 | end 518 | 519 | Writer.Inline.RawInline = function(el) 520 | if IGNORE_RAWBLOCKS then 521 | return "" 522 | end 523 | local str = el.text 524 | if format == "html" then 525 | if str == "" then 526 | return "" 527 | elseif str == "" then 528 | return " ~" 529 | elseif str == "" or str == "" then 530 | return "_" 531 | elseif str == "" or str == "" then 532 | return "" 533 | else 534 | return str 535 | end 536 | else 537 | return "" 538 | end 539 | end 540 | 541 | Writer.Inline.Citation = function(el) 542 | return el 543 | end 544 | 545 | Writer.Inline.Cite = function(el) 546 | links[#links + 1] = { caption = inlines(el.content), src = "" } 547 | return inlines(el.content) 548 | end 549 | 550 | Writer.Block.Plain = function(el) 551 | return inlines(el.content) 552 | end 553 | 554 | Writer.Block.RawBlock = function(el) 555 | local fmt = el.format 556 | local str = el.text 557 | if fmt == "html" then 558 | if string.starts_with(str, "" then 37 | COMMENT = true 38 | return pandoc.List() 39 | elseif str == "" then 40 | COMMENT = false 41 | return pandoc.List() 42 | end 43 | if 44 | ( 45 | string.starts_with(str, "") 48 | then 49 | local content = string.match(str, "") 50 | return pandoc.read(content, "markdown").blocks 51 | end 52 | if string.starts_with(str, "" then 218 | COMMENT = true 219 | return pandoc.Str("") 220 | elseif str == "" then 221 | COMMENT = false 222 | return pandoc.Str("") 223 | end 224 | if COMMENT == true then 225 | return pandoc.Str("") 226 | end 227 | return el 228 | end 229 | 230 | function SmallCaps(el) 231 | if COMMENT == true then 232 | return pandoc.Str("") 233 | end 234 | return el 235 | end 236 | 237 | function SoftBreak(el) 238 | if COMMENT == true then 239 | return pandoc.Str("") 240 | end 241 | return el 242 | end 243 | 244 | function Space(el) 245 | if COMMENT == true then 246 | return pandoc.Str("") 247 | end 248 | return el 249 | end 250 | 251 | function Span(el) 252 | if COMMENT == true then 253 | return pandoc.Str("") 254 | end 255 | return el 256 | end 257 | 258 | function Text(el) 259 | if COMMENT == true then 260 | return pandoc.Str("") 261 | end 262 | return el 263 | end 264 | 265 | function Strikeout(el) 266 | if COMMENT == true then 267 | return pandoc.Str("") 268 | end 269 | return el 270 | end 271 | 272 | function Strong(el) 273 | if COMMENT == true then 274 | return pandoc.Str("") 275 | end 276 | return el 277 | end 278 | 279 | function Subscript(el) 280 | if COMMENT == true then 281 | return pandoc.Str("") 282 | end 283 | return el 284 | end 285 | 286 | function Superscript(el) 287 | if COMMENT == true then 288 | return pandoc.Str("") 289 | end 290 | return el 291 | end 292 | 293 | function Underline(el) 294 | if COMMENT == true then 295 | return pandoc.Str("") 296 | end 297 | return el 298 | end 299 | -------------------------------------------------------------------------------- /scripts/template.html5: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | $for(author-meta)$ 8 | 9 | $endfor$ 10 | $if(date-meta)$ 11 | 12 | $endif$ 13 | $if(keywords)$ 14 | 15 | $endif$ 16 | $if(description-meta)$ 17 | 18 | $endif$ 19 | $if(title-prefix)$$title-prefix$ – $endif$$pagetitle$ 20 | $for(css)$ 21 | 22 | $endfor$ 23 | $if(math)$ 24 | $math$ 25 | $endif$ 26 | $for(header-includes)$ 27 | $header-includes$ 28 | $endfor$ 29 | 30 | 31 | $for(include-before)$ 32 | $include-before$ 33 | $endfor$ 34 | 35 |
36 |

$title$

37 | 54 |
55 | 56 | $if(toc)$ 57 | 65 | $endif$ 66 | 67 |
68 | $body$ 69 |
70 | 71 | $if(return-url)$ 72 | 77 | $endif$ 78 | 90 | $for(include-after)$ 91 | $include-after$ 92 | $endfor$ 93 | 94 | 95 | -------------------------------------------------------------------------------- /src/panvimdoc.jl: -------------------------------------------------------------------------------- 1 | module panvimdoc end 2 | -------------------------------------------------------------------------------- /test/dedupheadings.jl: -------------------------------------------------------------------------------- 1 | 2 | @testset "toc" begin 3 | doc = test_pandoc( 4 | """ 5 | # panvimdoc 6 | 7 | # TLDR 8 | 9 | ## Summary 1 10 | ## Summary 2 11 | 12 | # Motivation 13 | 14 | # References 15 | """; 16 | toc = true, 17 | dedup_subheadings = true, 18 | ) 19 | @test """ 20 | *test.txt* Test Description 21 | 22 | ============================================================================== 23 | Table of Contents *test-table-of-contents* 24 | 25 | 1. panvimdoc |test-panvimdoc| 26 | 2. TLDR |test-tldr| 27 | - Summary 1 |test-tldr-summary-1| 28 | - Summary 2 |test-tldr-summary-2| 29 | 3. Motivation |test-motivation| 30 | 4. References |test-references| 31 | 32 | ============================================================================== 33 | 1. panvimdoc *test-panvimdoc* 34 | 35 | 36 | ============================================================================== 37 | 2. TLDR *test-tldr* 38 | 39 | 40 | SUMMARY 1 *test-tldr-summary-1* 41 | 42 | 43 | SUMMARY 2 *test-tldr-summary-2* 44 | 45 | 46 | ============================================================================== 47 | 3. Motivation *test-motivation* 48 | 49 | 50 | ============================================================================== 51 | 4. References *test-references* 52 | 53 | Generated by panvimdoc 54 | 55 | vim:tw=78:ts=8:noet:ft=help:norl: 56 | """ == doc 57 | end 58 | -------------------------------------------------------------------------------- /test/definition-lists.jl: -------------------------------------------------------------------------------- 1 | @testset "definition-lists" begin 2 | doc = test_pandoc( 3 | raw""" 4 | :FnlCompileBuffer 5 | 6 | : Compiles current active fennel buffer 7 | 8 | :FnlCompile[!] 9 | 10 | : Diff compiles all indexed fennel files 11 | If bang! is present then forcefully compiles all `source` files 12 | 13 | :Fnl {expr} 14 | 15 | : Executes and Evalutate {expr} of fennel 16 | 17 | ```fennel 18 | :Fnl (print "Hello World") 19 | 20 | :Fnl (values some_var) 21 | ``` 22 | 23 | Testing 24 | """; 25 | toc = false, 26 | demojify = true, 27 | doc_mapping_project_name = true, 28 | ) 29 | @test raw""" 30 | *test.txt* Test Description 31 | 32 | *test-:FnlCompileBuffer* 33 | 34 | 35 | :FnlCompileBuffer Compiles current active fennel buffer 36 | 37 | 38 | *test-:FnlCompile* 39 | 40 | 41 | :FnlCompile[!] Diff compiles all indexed fennel files 42 | If bang! is present then forcefully compiles all `source` files 43 | 44 | 45 | *test-:Fnl* 46 | 47 | 48 | :Fnl {expr} Executes and Evalutate {expr} of fennel 49 | >fennel 50 | :Fnl (print "Hello World") 51 | 52 | :Fnl (values some_var) 53 | < 54 | Testing 55 | 56 | 57 | 58 | Generated by panvimdoc 59 | 60 | vim:tw=78:ts=8:noet:ft=help:norl: 61 | """ == doc 62 | 63 | doc = test_pandoc( 64 | raw""" 65 | :FnlCompileBuffer 66 | 67 | : Compiles current active fennel buffer 68 | 69 | :FnlCompile[!] 70 | 71 | : Diff compiles all indexed fennel files 72 | If bang! is present then forcefully compiles all `source` files 73 | 74 | :Fnl {expr} 75 | 76 | : Executes and Evalutate {expr} of fennel 77 | 78 | ```fennel 79 | :Fnl (print "Hello World") 80 | 81 | :Fnl (values some_var) 82 | ``` 83 | 84 | Testing 85 | """; 86 | toc = false, 87 | demojify = true, 88 | doc_mapping_project_name = false, 89 | ) 90 | @test raw""" 91 | *test.txt* Test Description 92 | 93 | *:FnlCompileBuffer* 94 | 95 | 96 | :FnlCompileBuffer Compiles current active fennel buffer 97 | 98 | 99 | *:FnlCompile* 100 | 101 | 102 | :FnlCompile[!] Diff compiles all indexed fennel files 103 | If bang! is present then forcefully compiles all `source` files 104 | 105 | 106 | *:Fnl* 107 | 108 | 109 | :Fnl {expr} Executes and Evalutate {expr} of fennel 110 | >fennel 111 | :Fnl (print "Hello World") 112 | 113 | :Fnl (values some_var) 114 | < 115 | Testing 116 | 117 | 118 | 119 | Generated by panvimdoc 120 | 121 | vim:tw=78:ts=8:noet:ft=help:norl: 122 | """ == doc 123 | end 124 | -------------------------------------------------------------------------------- /test/demojify.jl: -------------------------------------------------------------------------------- 1 | @testset "demojify" begin 2 | doc = test_pandoc( 3 | """ 4 | Hello world :wave: 5 | 6 | echo 😎 cool # comment 7 | 8 | ```lua 9 | "some/**/glob*" 10 | ``` 11 | 12 | `"some/**/glob*"` 13 | 14 | 15 | """; 16 | demojify = true, 17 | ) 18 | 19 | @test """ 20 | *test.txt* Test Description 21 | 22 | ============================================================================== 23 | Table of Contents *test-table-of-contents* 24 | 25 | Hello world 26 | 27 | echocool # comment 28 | 29 | >lua 30 | \"some/**/glob*\" 31 | < 32 | 33 | `\"some/**/glob*\"` 34 | 35 | Generated by panvimdoc 36 | 37 | vim:tw=78:ts=8:noet:ft=help:norl: 38 | """ == doc 39 | 40 | doc = test_pandoc( 41 | """ 42 | Hello world :wave: 43 | 44 | ```sh 45 | echo 😎cool # comment 46 | ``` 47 | 48 | """; 49 | demojify = false, 50 | ) 51 | 52 | @test """ 53 | *test.txt* Test Description 54 | 55 | ============================================================================== 56 | Table of Contents *test-table-of-contents* 57 | 58 | Hello world :wave: 59 | 60 | >sh 61 | echo 😎cool # comment 62 | < 63 | 64 | Generated by panvimdoc 65 | 66 | vim:tw=78:ts=8:noet:ft=help:norl: 67 | """ == doc 68 | 69 | doc = test_pandoc("test🫠🫢🫣🫡🫥🫤🥹🫱🫲🫳🫴🫰🫵🫶🫦🫅🫃🫄🧌🪸🪷🪹🪺🫘🫗🫙🛝🛞🛟🪬🪩🪫🩼🩻🫧🪪🟰"; demojify = true) 70 | 71 | @test """ 72 | *test.txt* Test Description 73 | 74 | ============================================================================== 75 | Table of Contents *test-table-of-contents* 76 | 77 | test 78 | 79 | Generated by panvimdoc 80 | 81 | vim:tw=78:ts=8:noet:ft=help:norl: 82 | """ == doc 83 | end 84 | -------------------------------------------------------------------------------- /test/description.jl: -------------------------------------------------------------------------------- 1 | # TODO: reimplement first line spacing in Julia 2 | function remove_first_line(s::String) 3 | lines = split(s, '\n') 4 | return join(lines[2:end], '\n') 5 | end 6 | 7 | @testset "Treesitter" begin 8 | doc = test_pandoc( 9 | """ 10 | Here's a YAML codeblock: 11 | 12 | ```yaml 13 | name: panvimdoc 14 | on: [push] 15 | jobs: 16 | docs: 17 | runs-on: ubuntu-latest 18 | name: pandoc to vimdoc 19 | steps: 20 | - uses: actions/checkout@v2 21 | ``` 22 | """; 23 | description = nothing, 24 | ) 25 | @test remove_first_line(""" 26 | *test.txt* For NVIM v0.8.0 Last change: $(CURRENT_DATE) 27 | 28 | ============================================================================== 29 | Table of Contents *test-table-of-contents* 30 | 31 | Here’s a YAML codeblock: 32 | 33 | >yaml 34 | name: panvimdoc 35 | on: [push] 36 | jobs: 37 | docs: 38 | runs-on: ubuntu-latest 39 | name: pandoc to vimdoc 40 | steps: 41 | - uses: actions/checkout@v2 42 | < 43 | 44 | Generated by panvimdoc 45 | 46 | vim:tw=78:ts=8:noet:ft=help:norl: 47 | """) == remove_first_line(doc) 48 | 49 | doc = test_pandoc( 50 | """ 51 | Here's a YAML codeblock: 52 | 53 | ```yaml 54 | name: panvimdoc 55 | on: [push] 56 | jobs: 57 | docs: 58 | runs-on: ubuntu-latest 59 | name: pandoc to vimdoc 60 | steps: 61 | - uses: actions/checkout@v2 62 | ``` 63 | """; 64 | vimversion = "VIM v9.0.0", 65 | description = nothing, 66 | ) 67 | @test remove_first_line(doc) == remove_first_line(""" 68 | *test.txt* For VIM v9.0.0 Last change: $(CURRENT_DATE) 69 | 70 | ============================================================================== 71 | Table of Contents *test-table-of-contents* 72 | 73 | Here’s a YAML codeblock: 74 | 75 | >yaml 76 | name: panvimdoc 77 | on: [push] 78 | jobs: 79 | docs: 80 | runs-on: ubuntu-latest 81 | name: pandoc to vimdoc 82 | steps: 83 | - uses: actions/checkout@v2 84 | < 85 | 86 | Generated by panvimdoc 87 | 88 | vim:tw=78:ts=8:noet:ft=help:norl: 89 | """) 90 | end 91 | -------------------------------------------------------------------------------- /test/headinglevelsby.jl: -------------------------------------------------------------------------------- 1 | @testset "levelheadingsby" begin 2 | doc = test_pandoc( 3 | """ 4 | # panvimdoc 5 | 6 | # TLDR 7 | 8 | ## Summary 1 9 | ## Summary 2 10 | 11 | # Motivation 12 | 13 | # References 14 | """; 15 | toc = true, 16 | shift_heading_level_by = 0, 17 | increment_heading_level_by = 0, 18 | ) 19 | @test """ 20 | *test.txt* Test Description 21 | 22 | ============================================================================== 23 | Table of Contents *test-table-of-contents* 24 | 25 | 1. panvimdoc |test-panvimdoc| 26 | 2. TLDR |test-tldr| 27 | - Summary 1 |test-summary-1| 28 | - Summary 2 |test-summary-2| 29 | 3. Motivation |test-motivation| 30 | 4. References |test-references| 31 | 32 | ============================================================================== 33 | 1. panvimdoc *test-panvimdoc* 34 | 35 | 36 | ============================================================================== 37 | 2. TLDR *test-tldr* 38 | 39 | 40 | SUMMARY 1 *test-summary-1* 41 | 42 | 43 | SUMMARY 2 *test-summary-2* 44 | 45 | 46 | ============================================================================== 47 | 3. Motivation *test-motivation* 48 | 49 | 50 | ============================================================================== 51 | 4. References *test-references* 52 | 53 | Generated by panvimdoc 54 | 55 | vim:tw=78:ts=8:noet:ft=help:norl: 56 | """ == doc 57 | 58 | doc = test_pandoc( 59 | """ 60 | # panvimdoc 61 | 62 | # TLDR 63 | 64 | ## Summary 1 65 | ## Summary 2 66 | 67 | # Motivation 68 | 69 | # References 70 | """; 71 | shift_heading_level_by = 0, 72 | increment_heading_level_by = 2, 73 | ) 74 | @test """ 75 | *test.txt* Test Description 76 | 77 | ============================================================================== 78 | Table of Contents *test-table-of-contents* 79 | 80 | 3. panvimdoc |test-panvimdoc| 81 | 4. TLDR |test-tldr| 82 | - Summary 1 |test-summary-1| 83 | - Summary 2 |test-summary-2| 84 | 5. Motivation |test-motivation| 85 | 6. References |test-references| 86 | 87 | ============================================================================== 88 | 3. panvimdoc *test-panvimdoc* 89 | 90 | 91 | ============================================================================== 92 | 4. TLDR *test-tldr* 93 | 94 | 95 | SUMMARY 1 *test-summary-1* 96 | 97 | 98 | SUMMARY 2 *test-summary-2* 99 | 100 | 101 | ============================================================================== 102 | 5. Motivation *test-motivation* 103 | 104 | 105 | ============================================================================== 106 | 6. References *test-references* 107 | 108 | Generated by panvimdoc 109 | 110 | vim:tw=78:ts=8:noet:ft=help:norl: 111 | """ == doc 112 | 113 | doc = test_pandoc( 114 | """ 115 | # panvimdoc 116 | 117 | # TLDR 118 | 119 | ## Summary 1 120 | ## Summary 2 121 | 122 | # Motivation 123 | 124 | # References 125 | """; 126 | shift_heading_level_by = 1, 127 | increment_heading_level_by = 2, 128 | ) 129 | @test """ 130 | *test.txt* Test Description 131 | 132 | ============================================================================== 133 | Table of Contents *test-table-of-contents* 134 | 135 | - panvimdoc |test-panvimdoc| 136 | - TLDR |test-tldr| 137 | - Motivation |test-motivation| 138 | - References |test-references| 139 | 140 | PANVIMDOC *test-panvimdoc* 141 | 142 | 143 | TLDR *test-tldr* 144 | 145 | 146 | SUMMARY 1 ~ 147 | 148 | 149 | SUMMARY 2 ~ 150 | 151 | 152 | MOTIVATION *test-motivation* 153 | 154 | 155 | REFERENCES *test-references* 156 | 157 | Generated by panvimdoc 158 | 159 | vim:tw=78:ts=8:noet:ft=help:norl: 160 | """ == doc 161 | end 162 | -------------------------------------------------------------------------------- /test/help.jl: -------------------------------------------------------------------------------- 1 | @testset "help-usage" begin 2 | panvimdoc = "./panvimdoc.sh" 3 | usage = cd(ROOT_DIR) do 4 | read(`$panvimdoc -h`, String) 5 | end 6 | @test contains(usage, "Usage:") 7 | @test contains(usage, "Arguments:") 8 | end 9 | -------------------------------------------------------------------------------- /test/ignore_rawblock.jl: -------------------------------------------------------------------------------- 1 | @testset "ignore_rawblock" begin 2 | doc = test_pandoc(""" 3 | this is my great software, and this is a demo of it 4 | 5 |

6 | bla 7 |

8 | """) 9 | @test """ 10 | *test.txt* Test Description 11 | 12 | ============================================================================== 13 | Table of Contents *test-table-of-contents* 14 | 15 | this is my great software, and this is a demo of it 16 | 17 | Generated by panvimdoc 18 | 19 | vim:tw=78:ts=8:noet:ft=help:norl: 20 | """ == doc 21 | 22 | doc = test_pandoc( 23 | """ 24 | this is my great software, and this is a demo of it 25 | 26 |

27 | bla 28 |

29 | """; 30 | ignore_rawblocks = false, 31 | ) 32 | @test """ 33 | *test.txt* Test Description 34 | 35 | ============================================================================== 36 | Table of Contents *test-table-of-contents* 37 | 38 | this is my great software, and this is a demo of it 39 | 40 |

41 | 42 | Generated by panvimdoc 43 | 44 | vim:tw=78:ts=8:noet:ft=help:norl: 45 | """ == doc 46 | end 47 | -------------------------------------------------------------------------------- /test/mapping.jl: -------------------------------------------------------------------------------- 1 | @testset "markdown" begin 2 | doc = test_pandoc( 3 | raw""" 4 | #### :FnlCompile[!] {doc=:FnlCompile} 5 | 6 | Diff compiles all indexed fennel files 7 | 8 | #### :FnlCompile[!] 9 | 10 | Diff compiles all indexed fennel files 11 | 12 | #### :[range]CommandName {doc=CommandName} 13 | 14 | #### :[range]CommandName 15 | """; 16 | toc = false, 17 | demojify = true, 18 | ) 19 | @test raw""" 20 | *test.txt* Test Description 21 | 22 | :FnlCompile[!] *:FnlCompile* 23 | 24 | Diff compiles all indexed fennel files 25 | 26 | 27 | :FnlCompile[!] *test-:FnlCompile* 28 | 29 | Diff compiles all indexed fennel files 30 | 31 | 32 | :[range]CommandName *CommandName* 33 | 34 | 35 | :[range]CommandName *test-:CommandName* 36 | 37 | Generated by panvimdoc 38 | 39 | vim:tw=78:ts=8:noet:ft=help:norl: 40 | """ == doc 41 | 42 | doc = test_pandoc( 43 | raw""" 44 | #### :FnlCompile[!] {doc=:FnlCompile} 45 | 46 | Diff compiles all indexed fennel files 47 | 48 | #### :FnlCompile[!] 49 | 50 | Diff compiles all indexed fennel files 51 | 52 | #### :[range]CommandName {doc=CommandName} 53 | 54 | #### :[range]CommandName 55 | """; 56 | toc = false, 57 | demojify = true, 58 | doc_mapping = false, 59 | ) 60 | @test raw""" 61 | *test.txt* Test Description 62 | 63 | :FNLCOMPILE[!] 64 | 65 | Diff compiles all indexed fennel files 66 | 67 | 68 | :FNLCOMPILE[!] 69 | 70 | Diff compiles all indexed fennel files 71 | 72 | 73 | :[RANGE]COMMANDNAME 74 | 75 | 76 | :[RANGE]COMMANDNAME 77 | 78 | Generated by panvimdoc 79 | 80 | vim:tw=78:ts=8:noet:ft=help:norl: 81 | """ == doc 82 | end 83 | -------------------------------------------------------------------------------- /test/markdown.jl: -------------------------------------------------------------------------------- 1 | @testset "markdown" begin 2 | doc = test_pandoc( 3 | raw""" 4 | # panvimdoc 5 | 6 |
7 | 8 |
9 | 10 |
11 | 12 |

13 | 14 | Latest release 15 | 16 |

17 | 18 | "Double quoted string" 19 | 20 | > Testing block quote 21 | 22 | | testing line 23 | | block 24 | 25 | ![caption](image.png) 26 | 27 | % Title 28 | spanning multiple lines 29 | % Author One 30 | Author Two; Author Three; 31 | Author Four 32 | 33 | # Additional markdown reader tests 34 | 35 | ## Blank line before URL in link reference 36 | 37 | [foo] and [bar] 38 | 39 | [foo]: 40 | /url 41 | 42 | [bar]: 43 | /url 44 | "title" 45 | 46 | ## Raw ConTeXt environments 47 | 48 | \placeformula \startformula 49 | L_{1} = L_{2} 50 | \stopformula 51 | 52 | \start[a2] 53 | \start[a2] 54 | \stop[a2] 55 | \stop[a2] 56 | 57 | ## Raw LaTeX environments 58 | 59 | \begin{center} 60 | \begin{tikzpicture}[baseline={([yshift=+-.5ex]current bounding box.center)}, level distance=24pt] 61 | \Tree [.{S} [.NP John\index{i} ] [.VP [.V likes ] [.NP himself\index{i,*j} ]]] 62 | \end{tikzpicture} 63 | \end{center} 64 | 65 | ## URLs with spaces and punctuation 66 | 67 | [foo](/bar and baz) 68 | [foo](/bar 69 | and baz ) 70 | [foo]( /bar and baz ) 71 | [foo](bar baz "title" ) 72 | 73 | [baz][] [bam][] [bork][] 74 | 75 | [baz]: /foo foo 76 | [bam]: /foo fee 77 | [bork]: /foo/zee zob (title) 78 | 79 | [Ward's method.](http://en.wikipedia.org/wiki/Ward's_method) 80 | 81 | ## Horizontal rules with spaces at end 82 | 83 | * * * * * 84 | 85 | -- - -- -- - 86 | 87 | ## Raw HTML before header 88 | 89 | 90 | 91 | ### my header 92 | 93 | ## $ in math 94 | 95 | $\$2 + \$3$ 96 | 97 | $x = \text{the $n$th root of $y$}$ 98 | 99 | This should not be math: 100 | 101 | $PATH 90 $PATH 102 | 103 | ## Commented-out list item 104 | 105 | - one 106 | 109 | - three 110 | 111 | ## Indented code at beginning of list 112 | 113 | - code 114 | code 115 | 116 | 1. code 117 | code 118 | 119 | 12345678. code 120 | code 121 | 122 | - code 123 | code 124 | 125 | - no code 126 | 127 | ## Backslash newline 128 | 129 | hi\ 130 | there 131 | 132 | ## Code spans 133 | 134 | `hi\` 135 | 136 | `hi 137 | there` 138 | 139 | `` hi````there `` 140 | 141 | `hi 142 | 143 | there` 144 | 145 | ## helptags 146 | 147 | This content includes a helptag for `:h :a-complex.messy-%tag` inbetween other text. 148 | 149 | ## Multilingual URLs 150 | 151 | 152 | 153 | [foo](/bar/测?x=测 "title") 154 | 155 | <测@foo.测.baz> 156 | 157 | ## Numbered examples 158 | 159 | (@) First example. 160 | (@foo) Second example. 161 | 162 | Explanation of examples (@foo) and (@bar). 163 | 164 | (@bar) Third example. 165 | 166 | ## Macros 167 | 168 | \newcommand{\tuple}[1]{\langle #1 \rangle} 169 | 170 | $\tuple{x,y}$ 171 | 172 | ## Case-insensitive references 173 | 174 | [Fum] 175 | 176 | [FUM] 177 | 178 | [bat] 179 | 180 | [fum]: /fum 181 | [BAT]: /bat 182 | 183 | ## Curly smart quotes 184 | 185 | “Hi” 186 | 187 | ‘Hi’ 188 | 189 | ## Consecutive lists 190 | 191 | - one 192 | - two 193 | 1. one 194 | 2. two 195 | 196 | a. one 197 | b. two 198 | 199 | ## Implicit header references 200 | 201 | ### My header 202 | 203 | ### My other header 204 | 205 | A link to [My header]. 206 | 207 | Another link to [it][My header]. 208 | 209 | Should be [case insensitive][my header]. 210 | 211 | Link to [Explicit header attributes]. 212 | 213 | [my other header]: /foo 214 | 215 | But this is not a link to [My other header], since the reference is defined. 216 | 217 | ## Explicit header attributes {#foobar .baz key="val"} 218 | 219 | > ## Header attributes inside block quote {#foobar .baz key="val"} 220 | 221 | ## Line blocks 222 | 223 | | But can a bee be said to be 224 | | or not to be an entire bee, 225 | | when half the bee is not a bee, 226 | | due to some ancient injury? 227 | | 228 | | Continuation 229 | line 230 | | and 231 | another 232 | 233 | ## Grid Tables 234 | 235 | +------------------+-----------+------------+ 236 | | col 1 | col 2 | col 3 | 237 | +==================+===========+============+ 238 | | r1 a | b | c | 239 | | r1 bis | b 2 | c 2 | 240 | +------------------+-----------+------------+ 241 | | r2 d | e | f | 242 | +------------------+-----------+------------+ 243 | 244 | Headless 245 | 246 | +------------------+-----------+------------+ 247 | | r1 a | b | c | 248 | | r1 bis | b 2 | c 2 | 249 | +------------------+-----------+------------+ 250 | | r2 d | e | f | 251 | +------------------+-----------+------------+ 252 | 253 | With alignments 254 | 255 | +------------------+-----------+------------+ 256 | | col 1 | col 2 | col 3 | 257 | +=================:+:==========+:==========:+ 258 | | r1 a | b | c | 259 | | r1 bis | b 2 | c 2 | 260 | +------------------+-----------+------------+ 261 | | r2 d | e | f | 262 | +------------------+-----------+------------+ 263 | 264 | Headless with alignments 265 | 266 | +-----------------:+:----------+:----------:+ 267 | | r1 a | b | c | 268 | | r1 bis | b 2 | c 2 | 269 | +------------------+-----------+------------+ 270 | | r2 d | e | f | 271 | +------------------+-----------+------------+ 272 | 273 | Spaces at ends of lines 274 | 275 | +------------------+-----------+------------+ 276 | | r1 a | b | c | 277 | | r1 bis | b 2 | c 2 | 278 | +------------------+-----------+------------+ 279 | | r2 d | e | f | 280 | +------------------+-----------+------------+ 281 | 282 | Multiple blocks in a cell 283 | 284 | +------------------+-----------+------------+ 285 | | # col 1 | # col 2 | # col 3 | 286 | | col 1 | col 2 | col 3 | 287 | +------------------+-----------+------------+ 288 | | r1 a | - b | c | 289 | | | - b 2 | c 2 | 290 | | r1 bis | - b 2 | c 2 | 291 | +------------------+-----------+------------+ 292 | 293 | East Asian characters have double width 294 | 295 | +--+----+ 296 | |魚|fish| 297 | +--+----+ 298 | 299 | Zero-width space in German 300 | 301 | +-------+-------+ 302 | |German |English| 303 | +-------+-------+ 304 | |Auf‌lage|edition| 305 | +-------+-------+ 306 | 307 | Zero-width non-joiner in Persian 308 | 309 | +-------+---------+ 310 | |می‌خواهم|I want to| 311 | +-------+---------+ 312 | 313 | Empty cells 314 | 315 | +---+---+ 316 | | | | 317 | +---+---+ 318 | 319 | 320 | Table with cells spanning multiple rows or columns: 321 | 322 | +---------------------+----------+ 323 | | Property | Earth | 324 | +=============+=======+==========+ 325 | | | min | -89.2 °C | 326 | | Temperature +-------+----------+ 327 | | 1961-1990 | mean | 14 °C | 328 | | +-------+----------+ 329 | | | min | 56.7 °C | 330 | +-------------+-------+----------+ 331 | 332 | Table with complex header: 333 | 334 | +---------------------+-----------------------+ 335 | | Location | Temperature 1961-1990 | 336 | | | in degree Celsius | 337 | | +-------+-------+-------+ 338 | | | min | mean | max | 339 | +=====================+=======+=======+=======+ 340 | | Antarctica | -89.2 | N/A | 19.8 | 341 | +---------------------+-------+-------+-------+ 342 | | Earth | -89.2 | 14 | 56.7 | 343 | +---------------------+-------+-------+-------+ 344 | 345 | ## Entities in links and titles 346 | 347 | [link](/ürl "öö!") 348 | 349 | 350 | 351 | 352 | 353 | [foobar] 354 | 355 | [foobar]: /ürl "öö!" 356 | 357 | ## Parentheses in URLs 358 | 359 | [link](/hi(there)) 360 | 361 | [link](/hithere\)) 362 | 363 | [linky] 364 | 365 | [linky]: hi_(there_(nested)) 366 | 367 | ## Backslashes in link references 368 | 369 | [\*\a](b) 370 | 371 | ## Reference link fallbacks 372 | 373 | [*not a link*] [*nope*]... 374 | 375 | ## Reference link followed by a citation 376 | 377 | MapReduce is a paradigm popularized by [Google] [@mapreduce] as its 378 | most vocal proponent. 379 | 380 | [Google]: http://google.com 381 | 382 | ## Empty reference links 383 | 384 | [foo2]: 385 | 386 | bar 387 | 388 | [foo2] 389 | 390 | ## Wrapping 391 | 392 | - blah blah blah blah blah blah blah blah blah blah blah blah blah blah 2015. 393 | 394 | ## Bracketed spans 395 | 396 | [*foo* bar baz [link](url)]{.class #id key=val} 397 | 398 | ## panvimdoc-include-comment 399 | 400 | 401 | 402 | 416 | 417 | """; 418 | toc = false, 419 | demojify = true, 420 | ) 421 | @test raw""" 422 | *test.txt* Test Description 423 | 424 | ============================================================================== 425 | 1. panvimdoc *test-panvimdoc* 426 | 427 | 428 | 429 | 430 | "Double quoted string" 431 | 432 | 433 | Testing block quote 434 | 435 | | testing line 436 | | block 437 | % Title spanning multiple lines % Author One Author Two; Author Three; Author 438 | Four 439 | 440 | 441 | ============================================================================== 442 | 2. Additional markdown reader tests *test-additional-markdown-reader-tests* 443 | 444 | 445 | BLANK LINE BEFORE URL IN LINK REFERENCE*test-blank-line-before-url-in-link-reference* 446 | 447 | foo and bar 448 | 449 | 450 | RAW CONTEXT ENVIRONMENTS *test-raw-context-environments* 451 | 452 | L_{1} = L_{2} 453 | 454 | 455 | RAW LATEX ENVIRONMENTS *test-raw-latex-environments* 456 | 457 | 458 | URLS WITH SPACES AND PUNCTUATION *test-urls-with-spaces-and-punctuation* 459 | 460 | foo foo foo foo 461 | 462 | 463 | baz bam bork 464 | 465 | Ward’s method. 466 | 467 | 468 | HORIZONTAL RULES WITH SPACES AT END *test-horizontal-rules-with-spaces-at-end* 469 | 470 | ------------------------------------------------------------------------------ 471 | ------------------------------------------------------------------------------ 472 | 473 | RAW HTML BEFORE HEADER *test-raw-html-before-header* 474 | 475 | 476 | 477 | 478 | MY HEADER ~ 479 | 480 | 481 | $ IN MATH *test-$-in-math* 482 | 483 | `\$2 + \$3` 484 | 485 | `x = \text{the $n$th root of $y$}` 486 | 487 | This should not be math: 488 | 489 | $PATH 90 $PATH 490 | 491 | 492 | COMMENTED-OUT LIST ITEM *test-commented-out-list-item* 493 | 494 | - one 495 | - three 496 | 497 | 498 | INDENTED CODE AT BEGINNING OF LIST *test-indented-code-at-beginning-of-list* 499 | 500 | - > 501 | code 502 | code 503 | < 504 | 1. > 505 | code 506 | code 507 | < 508 | 2. > 509 | code 510 | code 511 | < 512 | - > 513 | code 514 | code 515 | < 516 | - no code 517 | 518 | 519 | BACKSLASH NEWLINE *test-backslash-newline* 520 | 521 | hi there 522 | 523 | 524 | CODE SPANS *test-code-spans* 525 | 526 | `hi\` 527 | 528 | `hi there` 529 | 530 | `hi````there` 531 | 532 | `hi 533 | 534 | there` 535 | 536 | 537 | HELPTAGS *test-helptags* 538 | 539 | This content includes a helptag for |:a-complex.messy-%tag| inbetween other 540 | text. 541 | 542 | 543 | MULTILINGUAL URLS *test-multilingual-urls* 544 | 545 | 546 | 547 | foo 548 | 549 | @foo..baz 550 | 551 | 552 | NUMBERED EXAMPLES *test-numbered-examples* 553 | 554 | 1. First example. 555 | 2. Second example. 556 | 557 | Explanation of examples (2) and (3). 558 | 559 | 1. Third example. 560 | 561 | 562 | MACROS *test-macros* 563 | 564 | `\langle x,y \rangle` 565 | 566 | 567 | CASE-INSENSITIVE REFERENCES *test-case-insensitive-references* 568 | 569 | Fum 570 | 571 | FUM 572 | 573 | bat 574 | 575 | 576 | CURLY SMART QUOTES *test-curly-smart-quotes* 577 | 578 | "Hi" 579 | 580 | 'Hi' 581 | 582 | 583 | CONSECUTIVE LISTS *test-consecutive-lists* 584 | 585 | - one 586 | - two 587 | 588 | 1. one 589 | 2. two 590 | 591 | 1. one 592 | 2. two 593 | 594 | 595 | IMPLICIT HEADER REFERENCES *test-implicit-header-references* 596 | 597 | 598 | MY HEADER ~ 599 | 600 | 601 | MY OTHER HEADER ~ 602 | 603 | A link to |test-my-header|. 604 | 605 | Another link to |test-it|. 606 | 607 | Should be |test-case-insensitive|. 608 | 609 | Link to |test-explicit-header-attributes|. 610 | 611 | But this is not a link to My other header , since the reference is 612 | defined. 613 | 614 | 615 | EXPLICIT HEADER ATTRIBUTES *test-explicit-header-attributes* 616 | 617 | 618 | HEADER ATTRIBUTES INSIDE BLOCK QUOTE*test-header-attributes-inside-block-quote* 619 | 620 | LINE BLOCKS *test-line-blocks* 621 | 622 | 623 | | But can a bee be said to be 624 | |     or not to be an entire bee, 625 | |         when half the bee is not a bee, 626 | |             due to some ancient injury? 627 | | 628 | | Continuation line 629 | |   and another 630 | 631 | GRID TABLES *test-grid-tables* 632 | 633 | ------------------------------------------- 634 | col 1 col 2 col 3 635 | ------------------ ----------- ------------ 636 | r1 a r1 bis b b 2 c c 2 637 | 638 | r2 d e f 639 | ------------------------------------------- 640 | Headless 641 | 642 | ------------------ ----------- ------------ 643 | r1 a r1 bis b b 2 c c 2 644 | 645 | r2 d e f 646 | ------------------ ----------- ------------ 647 | With alignments 648 | 649 | ------------------------------------------- 650 | col 1 col 2 col 3 651 | ------------------ ----------- ------------ 652 | r1 a r1 bis b b 2 c c 2 653 | 654 | r2 d e f 655 | ------------------------------------------- 656 | Headless with alignments 657 | 658 | ------------------ ----------- ------------ 659 | r1 a r1 bis b b 2 c c 2 660 | 661 | r2 d e f 662 | ------------------ ----------- ------------ 663 | Spaces at ends of lines 664 | 665 | ------------------ ----------- ------------ 666 | r1 a r1 bis b b 2 c c 2 667 | 668 | r2 d e f 669 | ------------------ ----------- ------------ 670 | Multiple blocks in a cell 671 | 672 | +------------------+-----------+------------+ 673 | | col 1 | col 2 | col 3 | 674 | | | | | 675 | | col 1 | col 2 | col 3 | 676 | +------------------+-----------+------------+ 677 | | r1 a | - b | c c 2 c 2 | 678 | | | - b 2 | | 679 | | r1 bis | - b 2 | | 680 | +------------------+-----------+------------+ 681 | East Asian characters have double width 682 | 683 | -- ------ 684 | fish 685 | 686 | -- ------ 687 | Zero-widthspace in German 688 | 689 | --------- --------- 690 | German English 691 | 692 | Auf‌lage edition 693 | --------- --------- 694 | Zero-width non-joiner in Persian 695 | 696 | --------- --------- 697 | می‌خواهم I want to 698 | 699 | --------- --------- 700 | Empty cells 701 | 702 | --- --- 703 | 704 | 705 | --- --- 706 | Table with cells spanning multiple rows or columns: 707 | 708 | -------------------------------- 709 | Property Earth 710 | ------------- ------- ---------- 711 | Temperature min -89.2 °C 712 | 1961-1990 713 | 714 | mean 14 °C 715 | 716 | min 56.7 °C 717 | -------------------------------- 718 | Table with complex header: 719 | 720 | --------------------------------------------------- 721 | Location Temperature 722 | 1961-1990 in 723 | degree 724 | Celsius 725 | --------------------- ------------- ------- ------- 726 | min mean max 727 | 728 | Antarctica -89.2 N/A 19.8 729 | 730 | Earth -89.2 14 56.7 731 | --------------------------------------------------- 732 | 733 | ENTITIES IN LINKS AND TITLES *test-entities-in-links-and-titles* 734 | 735 | link 736 | 737 | 738 | 739 | me@exämple.com 740 | 741 | foobar 742 | 743 | 744 | PARENTHESES IN URLS *test-parentheses-in-urls* 745 | 746 | link 747 | 748 | link 749 | 750 | linky 751 | 752 | 753 | BACKSLASHES IN LINK REFERENCES *test-backslashes-in-link-references* 754 | 755 | 756 | 757 | 758 | REFERENCELINK FALLBACKS *test-referencelink-fallbacks* 759 | 760 | [_not a link_] [_nope_]… 761 | 762 | 763 | REFERENCE LINK FOLLOWED BY A CITATION*test-reference-link-followed-by-a-citation* 764 | 765 | MapReduce is a paradigm popularized by Google 766 | (**mapreduce?**) as its most vocal proponent. 767 | 768 | 769 | EMPTY REFERENCE LINKS *test-empty-reference-links* 770 | 771 | bar 772 | 773 | foo2 <> 774 | 775 | 776 | WRAPPING *test-wrapping* 777 | 778 | - blah blah blah blah blah blah blah blah blah blah blah blah blah blah 2015. 779 | 780 | 781 | BRACKETED SPANS *test-bracketed-spans* 782 | 783 | _foo_ bar baz link 784 | 785 | 786 | PANVIMDOC-INCLUDE-COMMENT *test-panvimdoc-include-comment* 787 | 788 | Neovim is a great text editor. 789 | 790 | Neovim supports |lua| plugins and is also: 791 | 792 | - Multiplatform 793 | - Open source 794 | 795 | 796 | ALL CONTENT TYPES *test-all-content-types* 797 | 798 | 799 | ARE SUPPORTED ~ 800 | 801 | See neovim.org . 802 | 803 | ============================================================================== 804 | 3. Links *test-links* 805 | 806 | 1. *caption*: image.png 807 | 2. *(**mapreduce?**)*: 808 | 809 | Generated by panvimdoc 810 | 811 | vim:tw=78:ts=8:noet:ft=help:norl: 812 | """ == doc 813 | end 814 | -------------------------------------------------------------------------------- /test/para.jl: -------------------------------------------------------------------------------- 1 | @testset "para" begin 2 | doc = test_pandoc( 3 | raw""" 4 | Pandoc supports definition lists: . 5 | This can be used to generate documentation of mappings. 6 | All of the content in curly braces `{...}` that is part of the header is dropped and a tag is created. 7 | """; 8 | toc = false, 9 | demojify = true, 10 | ) 11 | @test raw""" 12 | *test.txt* Test Description 13 | 14 | Pandoc supports definition lists: 15 | . This can be used to generate 16 | documentation of mappings. All of the content in curly braces `{...}` that is 17 | part of the header is dropped and a tag is created. 18 | 19 | Generated by panvimdoc 20 | 21 | vim:tw=78:ts=8:noet:ft=help:norl: 22 | """ == doc 23 | end 24 | -------------------------------------------------------------------------------- /test/runtests.jl: -------------------------------------------------------------------------------- 1 | using TestSetExtensions 2 | using Test 3 | using Dates 4 | using Pandoc 5 | 6 | ROOT_DIR = abspath(dirname(@__DIR__)) 7 | CUR_DIR = abspath(@__DIR__) 8 | SCRIPTS_DIR = joinpath(ROOT_DIR, "scripts") 9 | CURRENT_DATE = Dates.format(Dates.now(), dateformat"yyyy U dd") 10 | 11 | function test_pandoc( 12 | text::String; 13 | toc = true, 14 | dedup_subheadings = false, 15 | treesitter = true, 16 | demojify = false, 17 | description = "Test Description", 18 | vimversion = "NVIM v0.8.0", 19 | ignore_rawblocks = true, 20 | shift_heading_level_by = 0, 21 | increment_heading_level_by = 0, 22 | doc_mapping = true, 23 | doc_mapping_project_name = true, 24 | ) 25 | isfile(joinpath(ROOT_DIR, "doc/test.txt")) && rm(joinpath(ROOT_DIR, "doc/test.txt")) 26 | open(joinpath(CUR_DIR, "test.md"), "w") do file 27 | write(file, text) 28 | end 29 | filters = `--lua-filter=$SCRIPTS_DIR/skip-blocks.lua --lua-filter=$SCRIPTS_DIR/include-files.lua` 30 | if demojify 31 | filters = `$filters --lua-filter=$SCRIPTS_DIR/remove-emojis.lua` 32 | end 33 | metadata = `--metadata=project:"test" --metadata=vimversion:"$vimversion" --metadata=toc:$toc --metadata=dedupsubheadings:$dedup_subheadings --metadata=treesitter:$treesitter --metadata=ignorerawblocks:$ignore_rawblocks --metadata=incrementheadinglevelby:$increment_heading_level_by --metadata=docmappingproject:$doc_mapping_project_name --metadata=docmapping:$doc_mapping` 34 | if description !== nothing 35 | metadata = `$metadata --metadata=description:"$description"` 36 | end 37 | 38 | cd(ROOT_DIR) do 39 | run( 40 | `$(Pandoc.pandoc()) --citeproc --shift-heading-level-by=$shift_heading_level_by $metadata $filters -t $SCRIPTS_DIR/panvimdoc.lua $CUR_DIR/test.md -o test/test.txt`, 41 | ) 42 | end 43 | doc = read(joinpath(ROOT_DIR, "test/test.txt"), String) 44 | doc = join(rstrip.(split(doc, "\n")), "\n") 45 | rm(joinpath(ROOT_DIR, "test/test.txt")) 46 | rm(joinpath(CUR_DIR, "test.md")) 47 | return doc 48 | end 49 | 50 | @testset ExtendedTestSet "All the tests" begin 51 | @includetests ARGS 52 | end 53 | -------------------------------------------------------------------------------- /test/tables.jl: -------------------------------------------------------------------------------- 1 | @testset "toc" begin 2 | doc = test_pandoc( 3 | raw""" 4 | Right Left Center Default 5 | ------- ------ ---------- ------- 6 | 12 12 12 12 7 | 123 123 123 123 8 | 1 1 1 1 9 | 10 | Table: Demonstration of simple table syntax. 11 | 12 | ------- ------ ---------- ------- 13 | 12 12 12 12 14 | 123 123 123 123 15 | 1 1 1 1 16 | ------- ------ ---------- ------- 17 | 18 | ------------------------------------------------------------- 19 | Centered Default Right Left 20 | Header Aligned Aligned Aligned 21 | ----------- ------- --------------- ------------------------- 22 | First row 12.0 Example of a row that 23 | spans multiple lines. 24 | 25 | Second row 5.0 Here's another one. Note 26 | the blank line between 27 | rows. 28 | ------------------------------------------------------------- 29 | 30 | Table: Here's the caption. It, too, may span 31 | multiple lines. 32 | 33 | ----------- ------- --------------- ------------------------- 34 | First row 12.0 Example of a row that 35 | spans multiple lines. 36 | 37 | Second row 5.0 Here's another one. Note 38 | the blank line between 39 | rows. 40 | ----------- ------- --------------- ------------------------- 41 | 42 | : Here's a multiline table without a header. 43 | 44 | 45 | : Sample grid table. 46 | 47 | +---------------+---------------+--------------------+ 48 | | Fruit | Price | Advantages | 49 | +===============+===============+====================+ 50 | | Bananas | $1.34 | - built-in wrapper | 51 | | | | - bright color | 52 | +---------------+---------------+--------------------+ 53 | | Oranges | $2.10 | - cures scurvy | 54 | | | | - tasty | 55 | +---------------+---------------+--------------------+ 56 | 57 | Cells can span multiple columns or rows: 58 | 59 | +---------------------+----------+ 60 | | Property | Earth | 61 | +=============+=======+==========+ 62 | | | min | -89.2 °C | 63 | | Temperature +-------+----------+ 64 | | 1961-1990 | mean | 14 °C | 65 | | +-------+----------+ 66 | | | min | 56.7 °C | 67 | +-------------+-------+----------+ 68 | 69 | A table header may contain more than one row: 70 | 71 | +---------------------+-----------------------+ 72 | | Location | Temperature 1961-1990 | 73 | | | in degree Celsius | 74 | | +-------+-------+-------+ 75 | | | min | mean | max | 76 | +=====================+=======+=======+=======+ 77 | | Antarctica | -89.2 | N/A | 19.8 | 78 | +---------------------+-------+-------+-------+ 79 | | Earth | -89.2 | 14 | 56.7 | 80 | +---------------------+-------+-------+-------+ 81 | 82 | +---------------+---------------+--------------------+ 83 | | Right | Left | Centered | 84 | +==============:+:==============+:==================:+ 85 | | Bananas | $1.34 | built-in wrapper | 86 | +---------------+---------------+--------------------+ 87 | 88 | | Right | Left | Default | Center | 89 | |------:|:-----|---------|:------:| 90 | | 12 | 12 | 12 | 12 | 91 | | 123 | 123 | 123 | 123 | 92 | | 1 | 1 | 1 | 1 | 93 | 94 | fruit| price 95 | -----|-----: 96 | apple|2.05 97 | pear|1.37 98 | orange|3.09 99 | 100 | | One | Two | 101 | |-----+-------| 102 | | my | table | 103 | | is | nice | 104 | """; 105 | toc = false, 106 | ) 107 | @test raw""" 108 | *test.txt* Test Description 109 | 110 | Right Left Center Default 111 | ------- ------ -------- --------- 112 | 12 12 12 12 113 | 123 123 123 123 114 | 1 1 1 1 115 | 116 | : Demonstration of simple table syntax. 117 | ----- ----- ----- ----- 118 | 12 12 12 12 119 | 123 123 123 123 120 | 1 1 1 1 121 | ----- ----- ----- ----- 122 | --------------------------------------------------------------- 123 | Centered Default Right Aligned Left Aligned 124 | Header Aligned 125 | ----------- --------- --------------- ------------------------- 126 | First row 12.0 Example of a row that 127 | spans multiple lines. 128 | 129 | Second row 5.0 Here’s another one. Note 130 | the blank line between 131 | rows. 132 | --------------------------------------------------------------- 133 | 134 | : Here’s the caption. It, too, may span multiple lines. 135 | ----------- ------- --------------- ------------------------- 136 | First row 12.0 Example of a row that 137 | spans multiple lines. 138 | 139 | Second row 5.0 Here’s another one. Note 140 | the blank line between 141 | rows. 142 | ----------- ------- --------------- ------------------------- 143 | 144 | : Here’s a multiline table without a header. 145 | +---------------+---------------+--------------------+ 146 | | Fruit | Price | Advantages | 147 | +===============+===============+====================+ 148 | | Bananas | $1.34 | - built-in | 149 | | | | wrapper | 150 | | | | - bright color | 151 | +---------------+---------------+--------------------+ 152 | | Oranges | $2.10 | - cures scurvy | 153 | | | | - tasty | 154 | +---------------+---------------+--------------------+ 155 | 156 | : Sample grid table. 157 | Cells can span multiple columns or rows: 158 | 159 | -------------------------------- 160 | Property Earth 161 | ------------- ------- ---------- 162 | Temperature min -89.2 °C 163 | 1961-1990 164 | 165 | mean 14 °C 166 | 167 | min 56.7 °C 168 | -------------------------------- 169 | A table header may contain more than one row: 170 | 171 | --------------------------------------------------- 172 | Location Temperature 173 | 1961-1990 in 174 | degree 175 | Celsius 176 | --------------------- ------------- ------- ------- 177 | min mean max 178 | 179 | Antarctica -89.2 N/A 19.8 180 | 181 | Earth -89.2 14 56.7 182 | --------------------------------------------------- 183 | ---------------------------------------------------- 184 | Right Left Centered 185 | --------------- --------------- -------------------- 186 | Bananas $1.34 built-in wrapper 187 | 188 | ---------------------------------------------------- 189 | Right Left Default Center 190 | ------- ------ --------- -------- 191 | 12 12 12 12 192 | 123 123 123 123 193 | 1 1 1 1 194 | fruit price 195 | -------- ------- 196 | apple 2.05 197 | pear 1.37 198 | orange 3.09 199 | One Two 200 | ----- ------- 201 | my table 202 | is nice 203 | 204 | Generated by panvimdoc 205 | 206 | vim:tw=78:ts=8:noet:ft=help:norl: 207 | """ == doc 208 | end 209 | -------------------------------------------------------------------------------- /test/toc-emojis.jl: -------------------------------------------------------------------------------- 1 | @testset "markdown" begin 2 | doc = test_pandoc( 3 | raw""" 4 | ## :sparkles: Features 5 | 6 | ## :zap: Requirements 7 | 8 | ## :package: Installation 9 | 10 | ### Telescope extension 11 | 12 | ### Lazy loading 13 | 14 | ## :rocket: Usage 15 | 16 | ## :wrench: Configuration 17 | 18 | ### Defaults 19 | 20 | ### Session options 21 | 22 | ### Session save location 23 | 24 | ### Git branching 25 | 26 | ### Autosaving 27 | 28 | ### Autoloading 29 | 30 | ### Following current working directory 31 | 32 | ### Allowed directories 33 | 34 | ### Ignored directories 35 | 36 | ### Events / Callbacks 37 | 38 | ### Telescope extension 39 | 40 | ## :page_with_curl: License 41 | 42 | """; 43 | toc = true, 44 | demojify = true, 45 | dedup_subheadings = true, 46 | ) 47 | @test raw""" 48 | *test.txt* Test Description 49 | 50 | ============================================================================== 51 | Table of Contents *test-table-of-contents* 52 | 53 | - Features |test-features| 54 | - Requirements |test-requirements| 55 | - Installation |test-installation| 56 | - Usage |test-usage| 57 | - Configuration |test-configuration| 58 | - License |test-license| 59 | 60 | FEATURES *test-features* 61 | 62 | 63 | REQUIREMENTS *test-requirements* 64 | 65 | 66 | INSTALLATION *test-installation* 67 | 68 | 69 | TELESCOPE EXTENSION ~ 70 | 71 | 72 | LAZY LOADING ~ 73 | 74 | 75 | USAGE *test-usage* 76 | 77 | 78 | CONFIGURATION *test-configuration* 79 | 80 | 81 | DEFAULTS ~ 82 | 83 | 84 | SESSION OPTIONS ~ 85 | 86 | 87 | SESSION SAVE LOCATION ~ 88 | 89 | 90 | GIT BRANCHING ~ 91 | 92 | 93 | AUTOSAVING ~ 94 | 95 | 96 | AUTOLOADING ~ 97 | 98 | 99 | FOLLOWING CURRENT WORKING DIRECTORY ~ 100 | 101 | 102 | ALLOWED DIRECTORIES ~ 103 | 104 | 105 | IGNORED DIRECTORIES ~ 106 | 107 | 108 | EVENTS / CALLBACKS ~ 109 | 110 | 111 | TELESCOPE EXTENSION ~ 112 | 113 | 114 | LICENSE *test-license* 115 | 116 | Generated by panvimdoc 117 | 118 | vim:tw=78:ts=8:noet:ft=help:norl: 119 | """ == doc 120 | end 121 | -------------------------------------------------------------------------------- /test/toc.jl: -------------------------------------------------------------------------------- 1 | 2 | @testset "toc" begin 3 | doc = test_pandoc( 4 | """ 5 | # panvimdoc 6 | 7 | # TLDR 8 | 9 | ![caption](image.png) 10 | 11 | ## Summary 1 12 | ## Summary 2 13 | 14 | # Motivation 15 | 16 | # References 17 | """; 18 | toc = true, 19 | ) 20 | @test """ 21 | *test.txt* Test Description 22 | 23 | ============================================================================== 24 | Table of Contents *test-table-of-contents* 25 | 26 | 1. panvimdoc |test-panvimdoc| 27 | 2. TLDR |test-tldr| 28 | - Summary 1 |test-summary-1| 29 | - Summary 2 |test-summary-2| 30 | 3. Motivation |test-motivation| 31 | 4. References |test-references| 32 | 5. Links |test-links| 33 | 34 | ============================================================================== 35 | 1. panvimdoc *test-panvimdoc* 36 | 37 | 38 | ============================================================================== 39 | 2. TLDR *test-tldr* 40 | 41 | 42 | SUMMARY 1 *test-summary-1* 43 | 44 | 45 | SUMMARY 2 *test-summary-2* 46 | 47 | 48 | ============================================================================== 49 | 3. Motivation *test-motivation* 50 | 51 | 52 | ============================================================================== 53 | 4. References *test-references* 54 | 55 | ============================================================================== 56 | 5. Links *test-links* 57 | 58 | 1. *caption*: image.png 59 | 60 | Generated by panvimdoc 61 | 62 | vim:tw=78:ts=8:noet:ft=help:norl: 63 | """ == doc 64 | 65 | doc = test_pandoc( 66 | """ 67 | # panvimdoc 68 | 69 | # TLDR 70 | 71 | ![caption](image.png) 72 | 73 | ## Summary 1 74 | ## Summary 2 75 | 76 | # Motivation 77 | 78 | # References 79 | """; 80 | toc = false, 81 | ) 82 | @test """ 83 | *test.txt* Test Description 84 | 85 | ============================================================================== 86 | 1. panvimdoc *test-panvimdoc* 87 | 88 | 89 | ============================================================================== 90 | 2. TLDR *test-tldr* 91 | 92 | 93 | SUMMARY 1 *test-summary-1* 94 | 95 | 96 | SUMMARY 2 *test-summary-2* 97 | 98 | 99 | ============================================================================== 100 | 3. Motivation *test-motivation* 101 | 102 | 103 | ============================================================================== 104 | 4. References *test-references* 105 | 106 | ============================================================================== 107 | 5. Links *test-links* 108 | 109 | 1. *caption*: image.png 110 | 111 | Generated by panvimdoc 112 | 113 | vim:tw=78:ts=8:noet:ft=help:norl: 114 | """ == doc 115 | end 116 | -------------------------------------------------------------------------------- /test/treesitter.jl: -------------------------------------------------------------------------------- 1 | @testset "Treesitter" begin 2 | doc = test_pandoc(""" 3 | Here's a YAML codeblock: 4 | 5 | ```yaml 6 | name: panvimdoc 7 | on: [push] 8 | jobs: 9 | docs: 10 | runs-on: ubuntu-latest 11 | name: pandoc to vimdoc 12 | steps: 13 | - uses: actions/checkout@v2 14 | ``` 15 | """) 16 | @test doc == """ 17 | *test.txt* Test Description 18 | 19 | ============================================================================== 20 | Table of Contents *test-table-of-contents* 21 | 22 | Here’s a YAML codeblock: 23 | 24 | >yaml 25 | name: panvimdoc 26 | on: [push] 27 | jobs: 28 | docs: 29 | runs-on: ubuntu-latest 30 | name: pandoc to vimdoc 31 | steps: 32 | - uses: actions/checkout@v2 33 | < 34 | 35 | Generated by panvimdoc 36 | 37 | vim:tw=78:ts=8:noet:ft=help:norl: 38 | """ 39 | 40 | doc = test_pandoc( 41 | """ 42 | Here's a YAML codeblock: 43 | 44 | ```yaml 45 | name: panvimdoc 46 | on: [push] 47 | jobs: 48 | docs: 49 | runs-on: ubuntu-latest 50 | name: pandoc to vimdoc 51 | steps: 52 | - uses: actions/checkout@v2 53 | ``` 54 | """; 55 | treesitter = false, 56 | ) 57 | @test """ 58 | *test.txt* Test Description 59 | 60 | ============================================================================== 61 | Table of Contents *test-table-of-contents* 62 | 63 | Here’s a YAML codeblock: 64 | 65 | > 66 | name: panvimdoc 67 | on: [push] 68 | jobs: 69 | docs: 70 | runs-on: ubuntu-latest 71 | name: pandoc to vimdoc 72 | steps: 73 | - uses: actions/checkout@v2 74 | < 75 | 76 | Generated by panvimdoc 77 | 78 | vim:tw=78:ts=8:noet:ft=help:norl: 79 | """ == doc 80 | end 81 | --------------------------------------------------------------------------------