Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stop pandoc adding id automatically

I am using Pandoc's extention of markdown to produce HTML.

The following markdown:

#test{#specificId}
##test2
###test3

Produces the following html

<h1 id="specificId">test</h1>
<h2 id="test2">test2</h2>
<h3 id="test3">test3</h3>

Ideally, It would produce this:

<h1 id="specificId">test</h1>
<h2>test2</h2>
<h3>test3</h3>

I couldn't find an option in the documentation that would make the output only add an ID if it was explicitly added to the markdown although I don't really know what to search for.

Thanks in advance for any help.

like image 584
Jonathan Hodgson Avatar asked May 01 '17 09:05

Jonathan Hodgson


People also ask

What can Pandoc do?

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 extension can be enabled by adding +EXTENSION to the format name and disabled by adding -EXTENSION . For example, --from markdown_strict+footnotes is strict Markdown with footnotes enabled, while --from markdown-footnotes-pipe_tables is pandoc's Markdown without footnotes or pipe tables.

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 R?

pander: An R 'Pandoc' WriterContains some functions catching all messages, 'stdout' and other useful information while evaluating R code and other helpers to return user specified text elements (like: header, paragraph, table, image, lists etc.)


1 Answers

I found the answer.

The "feature" is called auto_identifiers. It can be disabled in the command by changing -f markdown to -f markdown-auto_identifiers

Hope this helps someone else.

like image 96
Jonathan Hodgson Avatar answered Sep 22 '22 12:09

Jonathan Hodgson