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 <https://pandoc.org> is rewritten as if it was
defined as [pandoc.org](https://pandoc.org).
- Before: https://pandoc.org
- After: pandoc.org
URLs for which the description is different from the target are left unchanged.
The filter modifies the internal document representation; it can be used with many publishing systems that are based on pandoc.
Pass the filter to pandoc via the --lua-filter (or -L) command
line option.
pandoc --lua-filter pretty-urls.lua ...
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.
---
filters:
- pretty-urls
---Use pandoc_args to invoke the filter. See the R Markdown
Cookbook
for details.
---
output:
word_document:
pandoc_args: ['--lua-filter=pretty-urls.lua']
---This pandoc Lua filter is published under the MIT license, see
file LICENSE for details.