aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/Markdown.hs
AgeCommit message (Collapse)AuthorFilesLines
2017-06-27Require nonempty alt text for `implicit_figures`.John MacFarlane1-1/+2
A figure with an empty caption doesn't make sense. Closes #2844.
2017-06-23Added comment in source.John MacFarlane1-0/+3
2017-06-23Markdown reader: interpret YAML metadata as Inlines when possible.John MacFarlane1-12/+13
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.
2017-06-23Text.Pandoc.Extensions: Added `Ext_raw_attribute`.John MacFarlane1-9/+33
Documented in MANUAL.txt. This is enabled by default in pandoc markdown and multimarkdown.
2017-06-20Removed an 'error' bomb.John MacFarlane1-1/+4
2017-06-20Move CR filtering from tabFilter to the readers.John MacFarlane1-1/+1
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.
2017-06-19Separated tracing from logging.John MacFarlane1-4/+2
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`.
2017-06-11Don't allow backslash + newline to affect block structure.John MacFarlane1-3/+8
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.
2017-06-10Changed all readers to take Text instead of String.John MacFarlane1-2/+3
Readers: Renamed StringReader -> TextReader. Updated tests. API change.
2017-05-30Added eastAsianLineBreakFilter to Shared.John MacFarlane1-11/+1
This used to live in the Markdown reader.
2017-05-28Markdown reader: use anyLineNewlineAlexander Krotov1-4/+3
2017-05-27Markdown writer: changes to `--reference-links`.John MacFarlane1-2/+6
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.
2017-05-25Added `spaced_reference_links` extension.John MacFarlane1-3/+5
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.
2017-05-25Markdown reader: warn for notes defined but not used.John MacFarlane1-6/+14
Closes #1718. Parsing.ParserState: Make stateNotes' a Map, add stateNoteRefs.
2017-05-24Markdown reader: fixed smart quotes after emphasis.John MacFarlane1-5/+6
E.g. in *foo*'s 'foo' Closes #2228.
2017-05-24Parsing: Provide parseFromString'.John MacFarlane1-19/+21
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.
2017-05-18Markdown: allow attributes in reference links to start on next line.John MacFarlane1-1/+3
This addresses a subsidiary issue in #3674.
2017-05-17Move anyLineNewline to Parsing.hsAlexander Krotov1-1/+1
2017-05-13Update dates in copyright noticesAlbert Krewinkel1-2/+2
This follows the suggestions given by the FSF for GPL licensed software. <https://www.gnu.org/prep/maintain/html_node/Copyright-Notices.html>
2017-05-11Combine grid table parsersAlbert Krewinkel1-83/+1
The grid table parsers for markdown and rst was combined into one single parser, slightly changing parsing behavior of both parsers: - The markdown parser now compactifies block content cell-wise: pure text blocks in cells are now treated as paragraphs only if the cell contains multiple paragraphs, and as plain blocks otherwise. Before, this was true only for single-column tables. - The rst parser now accepts newlines and multiple blocks in header cells. Closes: #3638
2017-05-06Markdown reader: improved parsing of indented raw HTML blocks.John MacFarlane1-1/+7
Previously we inadvertently interpreted indented HTML as code blocks. This was a regression. We now seek to determine the indentation level of the contents of an HTML block, and (optionally) skip that much indentation. As a side effect, indentation may be stripped off of raw HTML blocks, if `markdown_in_html_blocks` is used. This is better than having things interpreted as indented code blocks. Closes #1841.
2017-04-30Provide shared F monad functions for Markdown and Org readersAlbert Krewinkel1-4/+1
The `F` monads used for delayed evaluation of certain values in the Markdown and Org readers are based on a shared data type capturing the common pattern of both `F` types.
2017-04-06Allow raw latex commands starting with `\start` in Markdown.John MacFarlane1-1/+2
Previously these weren't allowed because they were interpreted as starting ConTeXt environments, even without a corresponding \stop... Closes #3558.
2017-03-22Markdown reader: allow latex macro definitions indented 1-3 spaces.John MacFarlane1-1/+8
Previously they only worked if nonindented.
2017-03-20Add `space_in_atx_header` extension.John MacFarlane1-0/+1
This is enabled by default in pandoc and GitHub markdown but not the other flavors. This requirse a space between the opening #'s and the header text in ATX headers (as CommonMark does but many other implementations do not). This is desirable to avoid falsely capturing things ilke #hashtag or #5 Closes #3512.
2017-03-11Markdown reader: optimized nonindentSpaces.John MacFarlane1-6/+3
Makes the benchmark go from 40 to 36 ms.
2017-03-05Markdown reader: fixed internal header links.John MacFarlane1-2/+7
Closes #2397. This patch also adds `shortcut_reference_links` to the list of mmd extensions.
2017-03-05Added readerAbbreviations to ParserState.John MacFarlane1-25/+16
Markdown reader now consults this to determine what is an abbreviation. Eventually it will be possible to specify a custom list (see #256).
2017-03-05Markdown reader: Fixed regression on left-biased union for metadata.John MacFarlane1-6/+9
When multiple YAML metadata blocks are used, and two define the same field, the value defined first takes precedence, according to the manual. This was changed briefly in ba3ee62323644134f2a5dd3277e3349d3681111a. This commit reverts to the original behavior and adds a test case.
2017-03-05Parse YAML metadata in a context that sees footnotes...John MacFarlane1-84/+83
defined in the body of the document. Closes #1279.
2017-03-04Markdown reader: treat span with class `smallcaps` as SmallCaps.John MacFarlane1-13/+18
This allows users to specify small caps in Markdown this way: [my text]{.smallcaps} See #1592.
2017-03-04Stylish-haskell automatic formatting changes.John MacFarlane1-49/+49
2017-03-02Markdown reader: when splitting pipe table cells, skip tex math.John MacFarlane1-1/+1
You might have a `|` character inside math. (Or for that matter something that the parser might mistake for raw HTML.) See #3481.
2017-02-17Markdown reader: Use logMessage instead of report.John MacFarlane1-5/+7
2017-02-11Use new warnings throughout the code base.John MacFarlane1-14/+11
2017-02-10Added Text.Pandoc.Logging (exported module).John MacFarlane1-0/+1
This now contains the Verbosity definition previously in Options, as well as a new LogMessage datatype that will eventually be used instead of raw strings for warnings. This will enable us, among other things, to provide machine-readable warnings if desired. See #3392.
2017-02-06Removed --parse-raw and readerParseRaw.John MacFarlane1-4/+0
These were confusing. Now we rely on the +raw_tex or +raw_html extension with latex or html input. Thus, instead of --parse-raw -f latex we use -f latex+raw_tex and instead of --parse-raw -f html we use -f html+raw_html
2017-01-27Shared: rename compactify', compactify'DL -> compactify, compactifyDL.John MacFarlane1-4/+4
2017-01-25More logging-related changes.John MacFarlane1-7/+3
Class: * Removed getWarnings, withWarningsToStderr * Added report * Added logOutput to PandocMonad * Make logOutput streaming in PandocIO monad * Properly reverse getLog output Readers: * Replaced use of trace with report DEBUG. TWiki Reader: Put everything inside PandocMonad m. API changes.
2017-01-25Changes to verbosity in writer and reader options.John MacFarlane1-1/+1
API changes: Text.Pandoc.Options: * Added Verbosity. * Added writerVerbosity. * Added readerVerbosity. * Removed writerVerbose. * Removed readerTrace. pandoc CLI: The `--trace` option sets verbosity to DEBUG; the `--quiet` option sets it to ERROR, and the `--verbose` option sets it to INFO. The default is WARNING.
2017-01-25Removed readerSmart and the --smart option; added Ext_smart extension.John MacFarlane1-3/+3
Now you will need to do -f markdown+smart instead of -f markdown --smart This change opens the way for writers, in addition to readers, to be sensitive to +smart, but this change hasn't yet been made. API change. Command-line option change. Updated manual.
2017-01-25Make Extensions a custom type instead of a Set Extension.John MacFarlane1-9/+9
The type is implemented in terms of an underlying bitset which should be more efficient. API change: from Text.Pandoc.Extensions export Extensions, emptyExtensions, extensionsFromList, enableExtension, disableExtension, extensionEnabled.
2017-01-25Markdown reader: Removed readMarkdownWithWarnings [API change].John MacFarlane1-10/+1
2017-01-25Have warningWithPos take a SourcePos rather than Maybe SourcePos.John MacFarlane1-5/+5
After all, we have warning if you don't want the source pos info.
2017-01-25Class: rename addWarning[WithPos] to warning[WithPos].John MacFarlane1-5/+5
There's already a function addWarning in Parsing! Maybe we can dispense with that now, but I still like 'warning' better as a name.
2017-01-25Readers: pass errors straight up to PandocMonad.Jesse Rosenthal1-2/+1
Since we've unified error types, we can just throw the same error at the toplevel.
2017-01-25Unify Errors.Jesse Rosenthal1-1/+2
2017-01-25Working on readers.Jesse Rosenthal1-221/+257
2017-01-08Fixed -f markdown_github-hard_line_breaks+escaped_line_breaks.John MacFarlane1-0/+1
Previously this did not properly enable escaped line breaks. Closes #3341.
2016-12-24markdown reader: disallow space between inline code and attributes (#3326)Mauro Bieg1-2/+2
closes #3323