Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pandoc: automatically convert URLs into hyperlinks

Is there an option which automatically converts URLs into hyperlinks in Pandoc?

E.g.

http://www.test.com

should become

[http://www.test.com](http://www.test.com)

Or even cooler would be without the protocol:

[www.test.com](http://www.test.com)
like image 887
Joshua Muheim Avatar asked Feb 15 '16 16:02

Joshua Muheim


People also ask

Can Pandoc convert HTML to markdown?

Pandoc can convert between numerous markup and word processing formats, including, but not limited to, various flavors of Markdown, HTML, LaTeX and Word docx.

Can Pandoc convert from PDF?

You can't. You can try opening the PDF in Word or Google Docs and saving in a format from which pandoc can convert directly.

What is Pandoc used for?

Pandoc is a command-line tool for converting files from one markup language to another. Markup languages use tags to annotate sections of a document. Commonly used markup languages include Markdown, ReStructuredText, HTML, LaTex, ePub, and Microsoft Word DOCX.

How do you use extensions in Pandoc?

An extensions can be enabled by adding +EXTENSION to the format name and disabled by adding -EXTENSION . For example, markdown_strict+footnotes is strict Markdown with footnotes enabled, while markdown-footnotes-pipe_tables is pandoc's Markdown without footnotes or pipe tables.


1 Answers

Just surround them in <> : <http://www.test.com>

echo "<http://example.com>" | pandoc
<p><a href="http://example.com" class="uri">http://example.com</a></p>

That will not work without the http:// though. See the documentation.

like image 126
scoa Avatar answered Oct 14 '22 15:10

scoa