Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PanDoc - Force converting into markdown to use # and ## for H1 and H2 respectively

I prefer the # and ## for Headers 1 and 2 respectively. I'd like to make my instance of PanDoc respect that when it is converting from say html into .md

Right now it converts H1s in the older style

Header 1
========

Is there a way to change this behavior.

I use PanDoc via Atom primarily. Not sure if this will have an effect. In researching I have concluded that the Atom functionality is flowing from my macOS systems PanDoc installation. So modifying the behavior there ought to flow through. If not, I'd be willing to change my behavior and use pandoc from the terminal if need be.

Thanks.

Thanks to the responder with the answer (atx-style-headers) achieved via command line using:

--atx-headers flag

Further explanation is available here at Pandocs documentation

like image 650
ercfre Avatar asked Jun 25 '18 00:06

ercfre


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 PDF to Markdown?

You can use the program pandoc on the SCF Linux and Mac machines (via the terminal window) to convert from formats such as HTML, LaTeX and Markdown to formats such as HTML, LaTeX, Word, OpenOffice, and PDF, among others.

How do I convert Word to Markdown in pandoc?

After installing, open your command prompt or terminal, navigate to the folder where you have saved your MS Word file, and enter the following command. As you can see, first, write pandoc to execute any pandoc command, and then write the file name of a file with extension which you want to convert to a markdown file.

Does Rmarkdown use pandoc?

A recent version of Pandoc (>= 1.12. 3) is required to use the rmarkdown package. RStudio also automatically includes this so you do not need to download Pandoc if you plan to use rmarkdown from the RStudio IDE.


1 Answers

Try:

pandoc --atx-headers -o try.md try.html

The output file try.md should have only ATX-style headers.

like image 72
shawnhcorey Avatar answered Oct 17 '22 20:10

shawnhcorey