What is the easiest way to convert the first kind of Markdown into the second kind of Markdown?
Headline 1
==========
Some text
Subheadline 1
-------------
More text
Headline 2
==========
Even more text
into
# Headline 1 #
Some text
## Subheadline 1 ##
More text
# Headline 2 #
Even more text
Linux or Mac OS X tools are preferred.
If you don't care about the #
s at the ends of lines, you can do
pandoc -f markdown -t markdown --atx-headers
See the pandoc documentation section on this for more.
Do you have access to a multi-line capable GREP? The following works inside TextPad (which, admittedly, is a Windows program):
Search for
^(.+)\n=+$
replace with
# \1 #
and similar lines for heading #2. Notation of hard return in the find expression and of Insert Numbered Group in the replacement may differ per software.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.