Skip to content

Makes URLs prettier by removing the protocol prefix.

License

Notifications You must be signed in to change notification settings

pandoc-ext/pretty-urls

Repository files navigation

pretty-urls

GitHub build status

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).

URLs for which the description is different from the target are left unchanged.

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.

---
filters:
  - pretty-urls
---

R Markdown

Use pandoc_args to invoke the filter. See the R Markdown Cookbook for details.

---
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.