https://github.com/pandoc-ext/pretty-urls
Makes URLs prettier by removing the protocol prefix.
https://github.com/pandoc-ext/pretty-urls
lua pandoc pandoc-filter quarto quarto-extension
Last synced: about 1 month ago
JSON representation
Makes URLs prettier by removing the protocol prefix.
- Host: GitHub
- URL: https://github.com/pandoc-ext/pretty-urls
- Owner: pandoc-ext
- License: mit
- Created: 2022-11-17T19:02:37.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-01-26T14:50:18.000Z (about 1 year ago)
- Last Synced: 2025-01-26T15:31:40.227Z (about 1 year ago)
- Topics: lua, pandoc, pandoc-filter, quarto, quarto-extension
- Language: Makefile
- Homepage:
- Size: 17.6 KB
- Stars: 9
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
pretty-urls
==================================================================
[![GitHub build status][CI badge]][CI workflow]
This filter "prettifies" bare URLs by removing the protocol
prefix, i.e., it drops the `https://` from the link text while
leaving the actual link unchanged.
Example: the URL `` is rewritten as if it was
defined as `[pandoc.org](https://pandoc.org)`.
- **Before**:
- **After**: [pandoc.org](https://pandoc.org)
URLs for which the description is different from the target are
left unchanged.
[CI badge]: https://img.shields.io/github/actions/workflow/status/pandoc-ext/pretty-urls/ci.yaml?branch=main&logo=github
[CI workflow]: https://github.com/pandoc-ext/pretty-urls/actions/workflows/ci.yaml
Usage
------------------------------------------------------------------
The filter modifies the internal document representation; it can
be used with many publishing systems that are based on pandoc.
### Plain pandoc
Pass the filter to pandoc via the `--lua-filter` (or `-L`) command
line option.
pandoc --lua-filter pretty-urls.lua ...
### Quarto
Users of Quarto can install this filter as an extension with
quarto install extension tarleb/pretty-urls
and use it by adding `pretty-urls` to the `filters` entry
in their YAML header.
``` yaml
---
filters:
- pretty-urls
---
```
### R Markdown
Use `pandoc_args` to invoke the filter. See the [R Markdown
Cookbook](https://bookdown.org/yihui/rmarkdown-cookbook/lua-filters.html)
for details.
``` yaml
---
output:
word_document:
pandoc_args: ['--lua-filter=pretty-urls.lua']
---
```
License
------------------------------------------------------------------
This pandoc Lua filter is published under the MIT license, see
file `LICENSE` for details.