Q:

Convert markdown links to html with Pandoc

In my new project I have multiple markdown files which are linked to each other. 
These links refer to the original .md files.
Example:
File README.md
...
1. [Development documentation](Development.md)
1. [User documentation](Usage.md)
...

If I convert these files with Pandoc, e.g. to html files, all links are still pointing to the original .md file. What I'm looking for is a way to convert also the link type, which means that output files should refer to the output file type such as HTML, PDF, TeX etc. Is there a way to convert the internal link type with Pandoc?
I use this to convert the files:
pandoc -f markdown -t html5 input.md -o output.html

A:

Example with the built-in Lua filters:
# links-to-html.lua
function Link(el)
  el.target = string.gsub(el.target, "%.md", ".html")
  return el
end

Then:
pandoc -f markdown -t html5 input.md -o output.html --lua-filter=links-to-html.lua

A:

You can create a filter that checks every link element and--if the url ends with .md--replaces it with .html.
Example with Python, using the panflute package:
import panflute as pf

def action(elem, doc):
    if isinstance(elem, pf.Link) and elem.url.endswith('.md'):
        elem.url = elem.url[:-3] + '.html'
        return elem

if __name__ == '__main__':
    pf.run_filter(action)

