summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/Markdown.hs
Commit message (Collapse)AuthorAge
* Markdown reader: Fix parsing bug with nested fenced divs.John MacFarlane2018-01-20
| | | | | | | | | 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.
* hlint code improvements.John MacFarlane2018-01-19
|
* Markdown reader: don't coalesce adjacent raw LaTeX blocks...John MacFarlane2018-01-17
| | | | | | if they are separated by a blank line. See lierdakil/pandoc-crossref#160 for motivation.
* Markdown reader: Improved inlinesInBalancedBrackets.John MacFarlane2018-01-14
| | | | | | | | The change both improves performance and fixes a regression whereby normal citations inside inline notes were not parsed correctly. Closes jgm/pandoc-citeproc#315.
* Update copyright notices to include 2018Albert Krewinkel2018-01-05
|
* Markdown reader: rewrite inlinesInBalancedBrackets.John MacFarlane2018-01-01
| | | | | | | | The rewrite is much more direct, avoiding parseFromString. And it performs significantly better; unfortunately, parsing time still increases exponentially. See #1735.
* Markdown reader: Avoid parsing raw tex unless \ + letter seen.John MacFarlane2017-12-30
| | | | This seems to help with the performance problem, #4216.
* `latex_macros` extension changes.John MacFarlane2017-12-22
| | | | | | | | | | | | 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.
* Markdown reader: improved raw tex parsing.John MacFarlane2017-12-22
| | | | | + Preserve original whitespace between blocks. + Recognize `\placeformula` as context.
* Markdown reader: be pickier about table captions.John MacFarlane2017-12-14
| | | | | | | 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.
* Markdown reader: always use four space rule for example lists.John MacFarlane2017-12-13
| | | | | | | | 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.
* Markdown: Improved computation of relative cell widths in pipe tables.John MacFarlane2017-12-12
|
* Pipe tables: use full text width for tables with wrapping cells.John MacFarlane2017-12-12
| | | | | | | | | | 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.
* Markdown reader: Don't parse native div as table caption.John MacFarlane2017-12-04
| | | | Closes #4119.
* Fixed YAML metadata with "chomp" (`|-`).John MacFarlane2017-11-11
| | | | | Previously if a YAML block under `|-` contained a blank line, pandoc would not parse it as metadata.
* Allow fenced code blocks to be indented 1-3 spaces.John MacFarlane2017-11-09
| | | | | | | This brings our handling of them into alignment with CommonMark's. Closes #??.
* hlintAlexander Krotov2017-11-02
|
* Markdown reader: make sure fenced div closers work in lists.John MacFarlane2017-10-31
| | | | | | | | | | | Previously the following failed: ::: {.class} 1. one 2. two ::: and you needed a blank line before the closing `:::`.
* More hlint fixes.John MacFarlane2017-10-29
|
* hlint suggestions.John MacFarlane2017-10-27
|
* Automatic reformating by stylish-haskell.John MacFarlane2017-10-27
|
* Fenced divs: ensure that paragraph at end doesn't become Plain.John MacFarlane2017-10-24
| | | | Added test case.
* Implemented fenced Divs.John MacFarlane2017-10-23
| | | | | | | | | + 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.
* Markdown reader: Fixed bug with indented code following raw LaTeX.John MacFarlane2017-10-02
| | | | Closes #3947.
* Added `--strip-comments` option, `readerStripComments` in `ReaderOptions`.John MacFarlane2017-09-17
| | | | | | | | | | * 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.
* Markdown reader: added inlines, inlines1.John MacFarlane2017-09-16
| | | | | | | | Eventually we'll add `processEmphasis` and `processBracketed` to this. This will allow us to conform to CommonMark rules and fix #3903 and #1735.
* Markdown reader: use CommonMark rules for list item nesting.John MacFarlane2017-08-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Markdown reader: fixed parsing of fenced code after list...John MacFarlane2017-08-18
| | | | | | ...when there is no intervening blank line. Closes #3733.
* Markdown reader: parse `-@roe` as suppress-author citation.John MacFarlane2017-08-18
| | | | | | | Previously only `[-@roe]` (with brackets) was recognized as suppress-author, and `-@roe` was treated the same as `@roe`. Closes jgm/pandoc-citeproc#237.
* Markdown reader: fixed spurious parsing as citation as reference def.John MacFarlane2017-08-07
| | | | | We now disallow reference keys starting with `@` if the `citations` extension is enabled. Closes #3840.
* LaTeX reader: Removed 'macro'.John MacFarlane2017-07-24
| | | | | | | | It is no longer necessary, since the rawLaTeXBlock parser will parse macro definitions. This also avoids the need for a separate latexMacro parser in the Markdown reader.
* Rewrote LaTeX reader with proper tokenization.John MacFarlane2017-07-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This rewrite is primarily motivated by the need to get macros working properly. A side benefit is that the reader is significantly faster (27s -> 19s in one benchmark, and there is a lot of room for further optimization). We now tokenize the input text, then parse the token stream. Macros modify the token stream, so they should now be effective in any context, including math. Thus, we no longer need the clunky macro processing capacities of texmath. A custom state LaTeXState is used instead of ParserState. This, plus the tokenization, will require some rewriting of the exported functions rawLaTeXInline, inlineCommand, rawLaTeXBlock. * Added Text.Pandoc.Readers.LaTeX.Types (new exported module). Exports Macro, Tok, TokType, Line, Column. [API change] * Text.Pandoc.Parsing: adjusted type of `insertIncludedFile` so it can be used with token parser. * Removed old texmath macro stuff from Parsing. Use Macro from Text.Pandoc.Readers.LaTeX.Types instead. * Removed texmath macro material from Markdown reader. * Changed types for Text.Pandoc.Readers.LaTeX's rawLaTeXInline and rawLaTeXBlock. (Both now return a String, and they are polymorphic in state.) * Added orgMacros field to OrgState. [API change] * Removed readerApplyMacros from ReaderOptions. Now we just check the `latex_macros` reader extension. * Allow `\newcommand\foo{blah}` without braces. Fixes #1390. Fixes #2118. Fixes #3236. Fixes #3779. Fixes #934. Fixes #982.
* Make `east_asian_line_breaks` affect all readers/writers.John MacFarlane2017-06-30
| | | | Closes #3703.
* Require nonempty alt text for `implicit_figures`.John MacFarlane2017-06-27
| | | | | | A figure with an empty caption doesn't make sense. Closes #2844.
* Added comment in source.John MacFarlane2017-06-23
|
* Markdown reader: interpret YAML metadata as Inlines when possible.John MacFarlane2017-06-23
| | | | | | | | | | | | | | | | | If the metadata field is all on one line, we try to interpret it as Inlines, and only try parsing as Blocks if that fails. If it extends over one line (including possibly the `|` or `>` character signaling an indented block), then we parse as Blocks. This was motivated by some German users finding that date: '22. Juin 2017' got parsed as an ordered list. Closes #3755.
* Text.Pandoc.Extensions: Added `Ext_raw_attribute`.John MacFarlane2017-06-23
| | | | | | Documented in MANUAL.txt. This is enabled by default in pandoc markdown and multimarkdown.
* Removed an 'error' bomb.John MacFarlane2017-06-20
|
* Move CR filtering from tabFilter to the readers.John MacFarlane2017-06-20
| | | | | | | | | | The readers previously assumed that CRs had been filtered from the input. Now we strip the CRs in the readers themselves, before parsing. (The point of this is just to simplify the parsers.) Shared now exports a new function `crFilter`. [API change] And `tabFilter` no longer filters CRs.
* Separated tracing from logging.John MacFarlane2017-06-19
| | | | | | | | | | | Formerly tracing was just log messages with a DEBUG log level. We now make these things independent. Tracing can be turned on or off in PandocMonad using `setTrace`; it is independent of logging. * Removed `DEBUG` from `Verbosity`. * Removed `ParserTrace` from `LogMessage`. * Added `trace`, `setTrace` to `PandocMonad`.
* Don't allow backslash + newline to affect block structure.John MacFarlane2017-06-11
| | | | | | | | | | | | | | | | | | | | Note that as a result of this change, the following, which formerly produced a header with two lines separated by a line break, will now produce a header followed by a paragraph: # Hi\ there This may affect some existing documents that relied on this undocumented and unintended behavior. This change makes pandoc more consistent with other Markdown implementations, and with itself (since the two-space version of a line break doesn't work inside ATX headers, and neither version works inside Setext headers). Closes #3730.
* Changed all readers to take Text instead of String.John MacFarlane2017-06-10
| | | | | | | | Readers: Renamed StringReader -> TextReader. Updated tests. API change.
* Added eastAsianLineBreakFilter to Shared.John MacFarlane2017-05-30
| | | | This used to live in the Markdown reader.
* Markdown reader: use anyLineNewlineAlexander Krotov2017-05-28
|
* Markdown writer: changes to `--reference-links`.John MacFarlane2017-05-27
| | | | | | | | | | | | | | | With `--reference-location` of `section` or `block`, pandoc will now repeat references that have been used in earlier sections. The Markdown reader has also been modified, so that *exactly* repeated references do not generate a warning, only references with the same label but different targets. The idea is that, with references after every block, one might want to repeat references sometimes. Closes #3701.
* Added `spaced_reference_links` extension.John MacFarlane2017-05-25
| | | | | | | | | | | | | | This is now the default for pandoc's Markdown. It allows whitespace between the two parts of a reference link: e.g. [a] [b] [b]: url This is now forbidden by default. Closes #2602.
* Markdown reader: warn for notes defined but not used.John MacFarlane2017-05-25
| | | | | | Closes #1718. Parsing.ParserState: Make stateNotes' a Map, add stateNoteRefs.
* Markdown reader: fixed smart quotes after emphasis.John MacFarlane2017-05-24
| | | | | | | | E.g. in *foo*'s 'foo' Closes #2228.
* Parsing: Provide parseFromString'.John MacFarlane2017-05-24
| | | | | | | | | | | | | | This is a verison of parseFromString specialied to ParserState, which resets stateLastStrPos at the end. This is almost always what we want. This fixes a bug where `_hi_` wasn't treated as emphasis in the following, because pandoc got confused about the position of the last word: - [o] _hi_ Closes #3690.
* Markdown: allow attributes in reference links to start on next line.John MacFarlane2017-05-18
| | | | This addresses a subsidiary issue in #3674.