aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/Markdown.hs
AgeCommit message (Collapse)AuthorFilesLines
2018-09-19Markdown reader: distinguish autolinks in the AST.John MacFarlane1-5/+7
With this change, autolinks are parsed as Links with the `uri` class. (The same is true for bare links, if the `autolink_bare_uris` extension is enabled.) Email autolinks are parsed as Links with the `email` class. This allows the distinction to be represented in the URI. Formerly the `uri` class was added to autolinks by the HTML writer, but it had to guess what was an autolink and could not distinguish `[http://example.com](http://example.com)` from `<http://example.com>`. It also incorrectly recognized `[pandoc](pandoc)` as an autolink. Now the HTML writer simply passes through the `uri` attribute if it is present, but does not add anything. The Textile writer has been modified so that the `uri` class is not explicitly added for autolinks, even if it is present. Closes #4913.
2018-09-16Markdown reader: example_lists should work without startnum.John MacFarlane1-1/+3
Closes #4908.
2018-09-15introduce --metadata-file optionmb211-2/+14
closes #1960 API change: Text.Pandoc.Readers.Markdown exports now `yamlToMeta`
2018-09-15Markdown Reader: factor out yamlMapmb211-40/+27
2018-09-15Markdown Reader: factor out yamlBsToMetamb211-4/+8
2018-09-15Markdown Reader: rename yamlToMeta to yamlToMetaValuemb211-9/+9
2018-08-15Markdown reader: Use "tex" instead of "latex" for raw tex-ish content.John MacFarlane1-7/+3
We can't always tell if it's LaTeX, ConTeXt, or plain TeX. Better just to use "tex" always. Also changed: ConTeXt writer: now outputs raw "tex" blocks as well as "context". (Closes #969). RST writer: uses ".. raw:: latex" for "tex" content. (RST doesn't support raw context anyway.) Note that if "context" or "latex" specifically is desired, you can still force that in a markdown document by using the raw attribute (see MANUAL.txt): ```{=latex} \foo ``` Note that this change may affect some filters, if they assume that raw tex parsed by the Markdown reader will be RawBlock (Format "latex"). In most cases it should be trivial to modify the filters to accept "tex" as well.
2018-08-07Markdown reader: Properly handle boolean values in YAML metadata.John MacFarlane1-1/+12
This fixes a regression in 2.2.3, which cause boolean values to be parsed as MetaInlines instead of MetaBool. Note also an undocumented (but desirable) change in 2.2.3: numbers are now parsed as MetaInlines rather than MetaString. Closes #4819.
2018-08-06Fix parsing of embedded mappings in YAML metadata.John MacFarlane1-24/+22
This fixes a regression in 2.2.3 which caused embedded mappings (e.g. mappings in sequences) not to work in YAML metadata. Closes #4817.
2018-07-30Markdown reader: allow unquoted numbers, booleans as YAML mapping keys.John MacFarlane1-26/+28
Previously in 2.2.2 you could not do --- 0: bar ... but only --- '0': bar ... With this change, both forms work.
2018-07-30Use YAML.decode rather than YAML.decodeStrict.John MacFarlane1-1/+1
(Minor)
2018-07-15Wrap emojis in span nodes (#4759)Anders Waldenborg1-4/+4
Text.Pandoc.Emoji now exports `emojiToInline`, which returns a Span inline containing the emoji character and some attributes with metadata (class `emoji`, attribute `data-emoji` with emoji name). Previously, emojis (as supported in Markdown and CommonMark readers, e.g ":smile:") were simply translated into the corresponding unicode code point. By wrapping them in Span nodes, we make it possible to do special handling such as giving them a special font in HTML output. We also open up the possibility of treating them differently when the `--ascii` option is selected (though that is not part of this commit). Closes #4743.
2018-06-29Fix compiler warnings.John MacFarlane1-4/+4
2018-06-29Use HsYAML instead of yaml for translations, YAML metadata.John MacFarlane1-56/+46
yaml wraps a C library; HsYAML is pure Haskell. Closes #4747. Advances #4535.
2018-06-13Markdown reader: allow empty code spans.John MacFarlane1-1/+1
E.g. `` ` ` ``.
2018-04-21Markdown reader/writer: spacing adjustments in tables.John MacFarlane1-3/+8
* Markdown writer now includes a blank line at the end of the row in a single-row multiline table, to prevent it from being interpreted as a simple table. Closes #4578. * Markdown reader does a better job computing the relative width of the last column in a multiline table, so we can round-trip tables without constantly shrinking the last column.
2018-04-19Markdown reader: allow empty attributes.John MacFarlane1-0/+2
See #2944.
2018-04-18Markdown reader: handle table w/o following blank line in fenced div.John MacFarlane1-3/+14
Closes #4560.
2018-04-16Markdown reader: remove "fallback" for doubleQuote parser.John MacFarlane1-4/+3
Previously the parser tried to be efficient -- if no end double quote was found, it would just return the contents. But this could backfire in a case like: **this should "be bold** since the fallback would return the content `"be bold**` and the closing boldface delimiter would never be encountered.
2018-03-18Use NoImplicitPrelude and explicitly import Prelude.John MacFarlane1-0/+2
This seems to be necessary if we are to use our custom Prelude with ghci. Closes #4464.
2018-03-17hlint fixes.John MacFarlane1-1/+1
2018-03-16Monoid/Semiground cleanup relying on custom Prelude.John MacFarlane1-1/+0
2018-03-13Require pandoc-types 1.17.4.John MacFarlane1-1/+1
And a few tweaks related to the Semigroups/Monoid change. Closes #4448.
2018-01-20Markdown reader: Fix parsing bug with nested fenced divs.John MacFarlane1-2/+0
Closes #4281. Previously we allowed "nonindent spaces" before the opening and closing `:::`, but this interfered with list parsing, so now we require the fences to be flush with the margin of the containing block.
2018-01-19hlint code improvements.John MacFarlane1-30/+28
2018-01-17Markdown reader: don't coalesce adjacent raw LaTeX blocks...John MacFarlane1-3/+9
if they are separated by a blank line. See lierdakil/pandoc-crossref#160 for motivation.
2018-01-14Markdown reader: Improved inlinesInBalancedBrackets.John MacFarlane1-13/+21
The change both improves performance and fixes a regression whereby normal citations inside inline notes were not parsed correctly. Closes jgm/pandoc-citeproc#315.
2018-01-05Update copyright notices to include 2018Albert Krewinkel1-2/+2
2018-01-01Markdown reader: rewrite inlinesInBalancedBrackets.John MacFarlane1-19/+13
The rewrite is much more direct, avoiding parseFromString. And it performs significantly better; unfortunately, parsing time still increases exponentially. See #1735.
2017-12-30Markdown reader: Avoid parsing raw tex unless \ + letter seen.John MacFarlane1-1/+2
This seems to help with the performance problem, #4216.
2017-12-22`latex_macros` extension changes.John MacFarlane1-3/+7
Don't pass through macro definitions themselves when `latex_macros` is set. The macros have already been applied. If `latex_macros` is enabled, then `rawLaTeXBlock` in Text.Pandoc.Readers.LaTeX will succeed in parsing a macro definition, and will update pandoc's internal macro map accordingly, but the empty string will be returned. Together with earlier changes, this closes #4179.
2017-12-22Markdown reader: improved raw tex parsing.John MacFarlane1-6/+9
+ Preserve original whitespace between blocks. + Recognize `\placeformula` as context.
2017-12-14Markdown reader: be pickier about table captions.John MacFarlane1-1/+1
A caption starts with a `:` which can't be followed by punctuation. Otherwise we can falsely interpret the start of a fenced div, or even a table header line like `:--:|:--:`, as a caption.
2017-12-13Markdown reader: always use four space rule for example lists.John MacFarlane1-9/+16
It would be awkward to indent example list contents to the first non-space character after the label, since example list labels are often long. Thanks to Bernhard Fisseni for the suggestion.
2017-12-12Markdown: Improved computation of relative cell widths in pipe tables.John MacFarlane1-1/+1
2017-12-12Pipe tables: use full text width for tables with wrapping cells.John MacFarlane1-2/+2
Previously we computed the column sizes based on the ratio between the header lines and the text width (as set by `--columns`). This meant that tables with very short header lines would be very narrow. With this change, pipe tables with wrapping cells will always take up the whole text width. The relative column widths will still be determined by the ratio of header lines, but they will be normalized to add up to 1.0.
2017-12-04Markdown reader: Don't parse native div as table caption.John MacFarlane1-1/+1
Closes #4119.
2017-11-11Fixed YAML metadata with "chomp" (`|-`).John MacFarlane1-2/+2
Previously if a YAML block under `|-` contained a blank line, pandoc would not parse it as metadata.
2017-11-09Allow fenced code blocks to be indented 1-3 spaces.John MacFarlane1-2/+6
This brings our handling of them into alignment with CommonMark's. Closes #??.
2017-11-02hlintAlexander Krotov1-11/+11
2017-10-31Markdown reader: make sure fenced div closers work in lists.John MacFarlane1-3/+11
Previously the following failed: ::: {.class} 1. one 2. two ::: and you needed a blank line before the closing `:::`.
2017-10-29More hlint fixes.John MacFarlane1-2/+2
2017-10-27hlint suggestions.John MacFarlane1-37/+33
2017-10-27Automatic reformating by stylish-haskell.John MacFarlane1-5/+4
2017-10-24Fenced divs: ensure that paragraph at end doesn't become Plain.John MacFarlane1-4/+9
Added test case.
2017-10-23Implemented fenced Divs.John MacFarlane1-0/+28
+ Added Ext_fenced_divs to Extensions (default for pandoc Markdown). + Document fenced_divs extension in manual. + Implemented fenced code divs in Markdown reader. + Added test. Closes #168.
2017-10-02Markdown reader: Fixed bug with indented code following raw LaTeX.John MacFarlane1-1/+1
Closes #3947.
2017-09-17Added `--strip-comments` option, `readerStripComments` in `ReaderOptions`.John MacFarlane1-1/+3
* Options: Added readerStripComments to ReaderOptions. * Added `--strip-comments` command-line option. * Made `htmlTag` from the HTML reader sensitive to this feature. This affects Markdown and Textile input. Closes #2552.
2017-09-16Markdown reader: added inlines, inlines1.John MacFarlane1-18/+23
Eventually we'll add `processEmphasis` and `processBracketed` to this. This will allow us to conform to CommonMark rules and fix #3903 and #1735.
2017-08-19Markdown reader: use CommonMark rules for list item nesting.John MacFarlane1-68/+61
Closes #3511. Previously pandoc used the four-space rule: continuation paragraphs, sublists, and other block level content had to be indented 4 spaces. Now the indentation required is determined by the first line of the list item: to be included in the list item, blocks must be indented to the level of the first non-space content after the list marker. Exception: if are 5 or more spaces after the list marker, then the content is interpreted as an indented code block, and continuation paragraphs must be indented two spaces beyond the end of the list marker. See the CommonMark spec for more details and examples. Documents that adhere to the four-space rule should, in most cases, be parsed the same way by the new rules. Here are some examples of texts that will be parsed differently: - a - b will be parsed as a list item with a sublist; under the four-space rule, it would be a list with two items. - a code Here we have an indented code block under the list item, even though it is only indented six spaces from the margin, because it is four spaces past the point where a continuation paragraph could begin. With the four-space rule, this would be a regular paragraph rather than a code block. - a code Here the code block will start with two spaces, whereas under the four-space rule, it would start with `code`. With the four-space rule, indented code under a list item always must be indented eight spaces from the margin, while the new rules require only that it be indented four spaces from the beginning of the first non-space text after the list marker (here, `a`). This change was motivated by a slew of bug reports from people who expected lists to work differently (#3125, #2367, #2575, #2210, #1990, #1137, #744, #172, #137, #128) and by the growing prevalance of CommonMark (now used by GitHub, for example). Users who want to use the old rules can select the `four_space_rule` extension. * Added `four_space_rule` extension. * Added `Ext_four_space_rule` to `Extensions`. * `Parsing` now exports `gobbleAtMostSpaces`, and the type of `gobbleSpaces` has been changed so that a `ReaderOptions` parameter is not needed.