Markdown writer: default to using ATX headings.

Previously we used Setext (underlined) headings by default.
The default is now ATX (`##` style).

* Add the `--markdown-headings=atx|setext` option.
* Deprecate `--atx-headers`.
* Add constructor 'ATXHeadingInLHS` constructor to `LogMessage` [API change].
* Support `markdown-headings` in defaults files.
* Document new options in MANUAL.

Closes #6662.
This commit is contained in:
Aner Lucero
2020-11-14 21:33:32 -08:00
committed by John MacFarlane
parent b8d17f7ae8
commit f63b76e169
36 changed files with 202 additions and 194 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ Make sure we don't get duplicate reference links, even with
`--reference-location=section`.
```
% pandoc --reference-links -t markdown --reference-location=section --atx-headers
% pandoc --reference-links -t markdown --reference-location=section
# a
![](a)
+3 -6
View File
@@ -3,8 +3,7 @@
<h2>hi
there</h2>
^D
hi there
--------
## hi there
```
```
@@ -12,14 +11,12 @@ hi there
<h2>hi <em>there
again</em></h2>
^D
hi *there again*
----------------
## hi *there again*
```
```
% pandoc --wrap=preserve -f html -t markdown
<h2>hi<br>there</h2>
^D
hi there
--------
## hi there
```
+1 -1
View File
@@ -1,5 +1,5 @@
```
% pandoc -f gfm -t gfm --atx-headers
% pandoc -f gfm -t gfm
# ~~Header~~
^D
# ~~Header~~
+4 -8
View File
@@ -2,11 +2,9 @@
% pandoc -f opml -t markdown
<?xml version="1.0"?> <opml version="1.0"> <head> <title> test </title> </head> <body> <outline text="test"> <outline text="try" _note="Here is inline html:&#xA;&#xA;&lt;div&gt; &#xA;&lt;balise&gt;&#xA;bla bla&#xA;&lt;/div&gt;"/> </outline> </body> </opml>
^D
test
====
# test
try
---
## try
Here is inline html:
@@ -22,11 +20,9 @@ Here is inline html:
% pandoc -f opml-raw_html-native_divs -t markdown
<?xml version="1.0"?> <opml version="1.0"> <head> <title> test </title> </head> <body> <outline text="test"> <outline text="try" _note="Here is inline html:&#xA;&#xA;&lt;div&gt; &#xA;&lt;balise&gt;&#xA;bla bla&#xA;&lt;/div&gt;"/> </outline> </body> </opml>
^D
test
====
# test
try
---
## try
Here is inline html:
+1 -2
View File
@@ -8,6 +8,5 @@
<img src="./my-figure.jpg" width="500" alt="My caption" /><figcaption aria-hidden="true">My caption</figcaption>
</figure>
Header 2
--------
## Header 2
```
+1 -2
View File
@@ -20,8 +20,7 @@ Blah [@doe].
^D
Blah.[^1]
References {#references .unnumbered}
==========
# References {#references .unnumbered}
::: {#refs .references .csl-bib-body .hanging-indent}
::: {#ref-doe .csl-entry}
+29
View File
@@ -0,0 +1,29 @@
```
% pandoc -t markdown --markdown-headings=setext
## Hi
### Ok
^D
Hi
--
### Ok
```
```
% pandoc -t markdown+lhs
# Hi
^D
[WARNING] Rendering heading 'Hi' as a paragraph.
ATX headings cannot be used in literate Haskell, because '#' is not
allowed in column 1. Consider using --markdown-headings=setext.
Hi
```
```
% pandoc -t markdown --markdown-headings=atx
Hi
--
^D
## Hi
```
+1 -2
View File
@@ -12,8 +12,7 @@ References {#references .unnumbered}
^D
Averroes (1982); Averroes (1892); Averroes (1869)
References {#references .unnumbered}
==========
# References {#references .unnumbered}
::: {#refs .references .csl-bib-body .hanging-indent line-spacing="2"}
::: {#ref-averroes/hercz .csl-entry}
+1 -2
View File
@@ -54,8 +54,7 @@ References {#references .unnumbered}
Foo (Pelikan 1971b, 1:12). Bar (Pelikan 1971c, 1:12). Baz (Pelikan
1971a, 12).
References {#references .unnumbered}
==========
# References {#references .unnumbered}
::: {#refs .references .csl-bib-body .hanging-indent}
::: {#ref-CTv1c2 .csl-entry}
+2 -4
View File
@@ -43,13 +43,11 @@ I have two citations [@Feminism2013gf; @Feminism2011ces].
References
==========
^D
Test
====
# Test
I have two citations ("Communities," 2011; "Geek Feminism," 2013).
References {#references .unnumbered}
==========
# References {#references .unnumbered}
::: {#refs .references .csl-bib-body .hanging-indent line-spacing="2"}
::: {#ref-Feminism2011ces .csl-entry}
+2 -4
View File
@@ -26,13 +26,11 @@ Expected
>
> \[Jane11\] Jane Doe. A book. 2011.
^D
No citation-label
-----------------
## No citation-label
Foo \[Jane11\].
Expected
--------
## Expected
> Foo \[Jane11\].
>
+2 -4
View File
@@ -27,13 +27,11 @@ Expected
> Doe, Jane. 2011. "A Title." *A Magazine*, January--February.
^D
Missing en-dash between months
------------------------------
## Missing en-dash between months
Foo (Doe 2011).
Expected
--------
## Expected
> Doe, Jane. 2011. "A Title." *A Magazine*, January--February.
+1 -2
View File
@@ -23,8 +23,7 @@ References {#references .unnumbered}
^D
Foo (Doe 1999).
References {#references .unnumbered}
==========
# References {#references .unnumbered}
::: {#refs .references .csl-bib-body .hanging-indent}
::: {#ref-doe1 .csl-entry}
+1 -2
View File
@@ -20,8 +20,7 @@ References {#references .unnumbered}
^D
Foo (Author 1998).
References {#references .unnumbered}
==========
# References {#references .unnumbered}
::: {#refs .references .csl-bib-body .hanging-indent}
::: {#ref-item1 .csl-entry}
+1 -2
View File
@@ -25,8 +25,7 @@ Minimal example
Here is some text that needs a citation [@AuthorOne2014].
^D
Minimal example
===============
# Minimal example
Here is some text that needs a citation (*1*).
+1 -2
View File
@@ -26,8 +26,7 @@ References {#references .unnumbered}
^D
Foo (Doe 2018, in press).
References {#references .unnumbered}
==========
# References {#references .unnumbered}
::: {#refs .references .csl-bib-body .hanging-indent}
::: {#ref-item2 .csl-entry}
+1 -2
View File
@@ -42,8 +42,7 @@ references:
^D
Blah blah (Doe 2010, 2007, 2008).
References {#references .unnumbered}
==========
# References {#references .unnumbered}
::: {#refs .references .csl-bib-body .hanging-indent}
::: {#ref-item2 .csl-entry}
+1 -2
View File
@@ -90,8 +90,7 @@ coauthors' last names (regardless of how many coauthors there are)." and
chronological order is maintained, regardless of the added abbreviation.
\[ed., trans., comp., or whatever\]"
References {#references .unnumbered}
==========
# References {#references .unnumbered}
::: {#refs .references .csl-bib-body .hanging-indent}
::: {#ref-doe .csl-entry}
+1 -2
View File
@@ -25,8 +25,7 @@ References
^D
(Faraday, forthcoming)
References {#references .unnumbered}
==========
# References {#references .unnumbered}
::: {#refs .references .csl-bib-body .hanging-indent}
::: {#ref-Faraday-forthcoming .csl-entry}
+1 -2
View File
@@ -22,8 +22,7 @@ References
In this item, the title replaces the (unknown) author (see 14.79)
(*Stanze in lode della donna brutta* 1547, 12).
References {#references .unnumbered}
==========
# References {#references .unnumbered}
::: {#refs .references .csl-bib-body .hanging-indent}
::: {#ref-stanze .csl-entry}
+2 -4
View File
@@ -41,8 +41,7 @@ Foo [@doe, CL, 89]
References
==========
^D
Text
====
# Text
Foo[^1]
@@ -54,8 +53,7 @@ Foo[^4]
Foo[^5]
References {#references .unnumbered}
==========
# References {#references .unnumbered}
::: {#refs .references .csl-bib-body .hanging-indent}
::: {#ref-doe .csl-entry}
+1 -2
View File
@@ -24,8 +24,7 @@ Some text.[^1]
[^1]: Comment regarding text, supported by citation [@OCLC_i1099].
^D
Title
=====
# Title
Some text.[^1]
+1 -2
View File
@@ -120,8 +120,7 @@ Doe (2006e) -- article-newspaper
Doe (2006b) -- article-newspaper YM
References {#references .unnumbered}
==========
# References {#references .unnumbered}
::: {#refs .references .csl-bib-body .hanging-indent}
::: {#ref-item2a .csl-entry}
@@ -48,8 +48,7 @@ References {#references .unnumbered}
locator [-@item2 p. 44].
^D
[WARNING] Citeproc: citation nonexistent not found
Pandoc with citeproc-hs
=======================
# Pandoc with citeproc-hs
([**nonexistent?**](#ref-nonexistent))
@@ -82,8 +81,7 @@ Now some modifiers.[^3]
With some markup (*see* [Doe 2005, 32](#ref-item1)).
References {#references .unnumbered}
==========
# References {#references .unnumbered}
::: {#refs .references .csl-bib-body .hanging-indent}
::: {#ref-item1 .csl-entry}
@@ -49,8 +49,7 @@ References {#references .unnumbered}
[-@item1], and now Doe with a locator [-@item2 p. 44].
^D
[WARNING] Citeproc: citation nonexistent not found
Pandoc with citeproc-hs
=======================
# Pandoc with citeproc-hs
[^1]
@@ -80,8 +79,7 @@ Now some modifiers.[^13]
With some markup.[^14]
References {#references .unnumbered}
==========
# References {#references .unnumbered}
::: {#refs .references .csl-bib-body .hanging-indent}
::: {#ref-item2 .csl-entry}
+2 -4
View File
@@ -49,8 +49,7 @@ References {#references .unnumbered}
locator [-@item2 p. 44].
^D
[WARNING] Citeproc: citation nonexistent not found
Pandoc with citeproc-hs
=======================
# Pandoc with citeproc-hs
[**nonexistent?**](#ref-nonexistent)
@@ -83,8 +82,7 @@ Now some modifiers.[^3]
With some markup *see* [\[1, p. 32\]](#ref-item1).
References {#references .unnumbered}
==========
# References {#references .unnumbered}
::: {#refs .references .csl-bib-body}
::: {#ref-item1 .csl-entry}
+9 -18
View File
@@ -23,34 +23,25 @@
- [E](#e)
- [e](#e-1)
A
=
# A
b
-
## b
B
=
# B
b
-
## b
::: {.interior}
C
=
# C
cc
--
## cc
D
=
# D
:::
::: {.blue}
E
=
# E
e
-
## e
:::
```