aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Extensions.hs
AgeCommit message (Collapse)AuthorFilesLines
2019-10-07Remove derive_json_via_th flag; always use TH.John MacFarlane1-18/+0
This cuts down on code duplication and reduces the chance for errors. See #4083.
2019-09-29Raise error on unsupported extensions. Closes #4338.John MacFarlane1-15/+151
+ An error is now raised if you try to specify (enable or disable) an extension that does not affect the given format, e.g. `docx+pipe_tables`. + The `--list-extensions[=FORMAT]` option now lists only extensions that affect the given FORMAT. + Text.Pandoc.Error: Add constructors `PandocUnknownReaderError`, `PandocUnknownWriterError`, `PandocUnsupportedExtensionError`. [API change] + Text.Pandoc.Extensions now exports `getAllExtensions`, which returns the extensions that affect a given format (whether enabled by default or not). [API change] + Text.Pandoc.Extensions: change type of `parseFormatSpec` from `Either ParseError (String, Extensions -> Extensions)` to `Either ParseError (String, [Extension], [Extension])` [API change]. + Text.Pandoc.Readers: change type of `getReader` so it returns a value in the PandocMonad instance rather than an Either [API change]. Exceptions for unknown formats and unsupported extensions are now raised by this function and need not be handled by the calling function. + Text.Pandoc.Writers: change type of `getWriter` so it returns a value in the PandocMonad instance rather than an Either [API change]. Exceptions for unknown formats and unsupported extensions are now raised by this function and need not be handled by the calling function.
2019-09-28Use Prelude.fail to avoid ambiguity with fail from GHC.Base.John MacFarlane1-1/+1
2019-09-24odt: Add external option for native numberingNils Carlson1-0/+1
This adds an external options +native_numbering to the ODT writer enabling enumeration of figures and tables in ODT output.
2019-09-22Make `plain` output plainer.John MacFarlane1-0/+1
Previously we used the following Project Gutenberg conventions for plain output: - extra space before and after level 1 and 2 headings - all-caps for strong emphasis `LIKE THIS` - underscores surrounding regular emphasis `_like this_` This commit makes `plain` output plainer. Strong and Emph inlines are rendered without special formatting. Headings are also rendered without special formatting, and with only one blank line following. To restore the former behavior, use `-t plain+gutenberg`. API change: Add `Ext_gutenberg` constructor to `Extension`. See #5741.
2019-07-10Extensions.hs fix typo in PHP Markdown commentMauro Bieg1-1/+1
2019-05-18Add tex_math_dollars to multimarkdownExtensions.John MacFarlane1-0/+1
This form is now supported in multimarkdown, in addition to `tex_math_double_backslash`. See #5512.
2019-03-01Remove license boilerplate.John MacFarlane1-18/+0
The haddock module header contains essentially the same information, so the boilerplate is redundant and just one more thing to get out of sync.
2019-02-04Add missing copyright notices and remove license boilerplate (#5112)Albert Krewinkel1-2/+2
Quite a few modules were missing copyright notices. This commit adds copyright notices everywhere via haddock module headers. The old license boilerplate comment is redundant with this and has been removed. Update copyright years to 2019. Closes #4592.
2019-02-04More carefully groom ipynb default extensions.John MacFarlane1-2/+18
2019-02-04Add `all_symbols_escapable` to githubMarkdownExtensions.John MacFarlane1-1/+1
2019-01-22Support ipynb (Jupyter notebook) as input and output format.John MacFarlane1-0/+2
[API change] * Depend on ipynb library. * Add `ipynb` as input and output format. * Added Text.Pandoc.Readers.Ipynb (supports both nbformat v3 and v4). * Added Text.Pandoc.Writers.Ipynb (supports nbformat v4). * Added ipynb readers and writers to T.P.Readers, T.P.Writers, and T.P.Extensions. Register the file extension .ipynb for this format. * Add `PandocIpynbDecodingError` constructor to Text.Pandoc.Error.Error. * Note: there is no template for ipynb.
2019-01-02Implement task lists (#5139)Mauro Bieg1-0/+3
Closes #3051
2018-11-11Text.Pandoc.Shared: add parameter to uniqueIdent, inlineListToIdentifier.John MacFarlane1-5/+8
The parameter is Extensions. This allows these functions to be sensitive to the settings of `Ext_gfm_auto_identifiers` and `Ext_ascii_identifiers`. This allows us to use `uniqueIdent` in the CommonMark reader, replacing some custom code. It also means that `gfm_auto_identifiers` can now be used in all formats. Semantically, `gfm_auto_identifiers` is now a modifier of `auto_identifiers`; for identifiers to be set, `auto_identifiers` must be turned on, and then the type of identifier produced depends on `gfm_auto_identifiers` and `ascii_identifiers` are set. Closes #5057.
2018-11-11Remove `ascii_identifiers` from `githubMarkdownExtensions`.John MacFarlane1-1/+0
GitHub doesn't seem to strip non-ascii characters.
2018-11-11Fix CPP conditional for TH pragmaAlbert Krewinkel1-2/+2
The condition was from an earlier version.
2018-11-04Add cabal flag `derive_json_via_th`Albert Krewinkel1-4/+22
Disabling the flag will cause derivation of ToJSON and FromJSON instances via GHC Generics instead of Template Haskell. The flag is enabled by default, as deriving via Generics can be slow (see #4083).
2018-09-15Fix haddock on 'Ext_footnotes'Chris Martin1-1/+1
2018-05-30Clarify how Ext_east_asian_line_breaks extension works (API docs).kaizhang911-1/+4
Note that it will not take effect when readers/writers are called as libraries (#4674).
2018-03-30Set default extensions for "beamer" same as "latex".John MacFarlane1-0/+4
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-16Monoid/Semiground cleanup relying on custom Prelude.John MacFarlane1-6/+0
2018-03-16Extensions: Semigroup instance for Extensions with base >= 4.9.John MacFarlane1-4/+13
2018-03-02Make `Ext_raw_html` default for commonmark format.John MacFarlane1-0/+2
2018-02-22Extensions: Add Ext_stylesJesse Rosenthal1-0/+1
This will be used in the docx reader (defaulting to off) to read pargraph and character styles not understood by pandoc (as divs and spans, respectively).
2018-01-15ConTeXt writer: Use xtables instead of Tables (#4223)Henri Menke1-0/+1
- Default to xtables for context output. - Added `ntb` extension (affecting context writer only) to use Natural Tables instead. - Added `Ext_ntb` constructor to `Extension` (API change).
2018-01-05Update copyright notices to include 2018Albert Krewinkel1-2/+2
2017-12-28Alphabetical order Extension constructors.John MacFarlane1-61/+61
This makes them appear in order in `--list-extensions`.
2017-12-27HTML reader: parse div with class `line-block` as LineBlock.John MacFarlane1-0/+1
See #4162.
2017-12-17OPML reader: enable raw HTML and other extensions by default for notes.John MacFarlane1-0/+1
This fixes a regression in 2.0. Note that extensions can now be individually disabled, e.g. `-f opml-smart-raw_html`. Closes #4164.
2017-12-04Add `empty_paragraphs` extension.John MacFarlane1-0/+1
* Deprecate `--strip-empty-paragraphs` option. Instead we now use an `empty_paragraphs` extension that can be enabled on the reader or writer. By default, disabled. * Add `Ext_empty_paragraphs` constructor to `Extension`. * Revert "Docx reader: don't strip out empty paragraphs." This reverts commit d6c58eb836f033a48955796de4d9ffb3b30e297b. * Implement `empty_paragraphs` extension in docx reader and writer, opendocument writer, html reader and writer. * Add tests for `empty_paragraphs` extension.
2017-11-21Change Generic JSON instances to TemplateHaskell (#4085)Jasper Van der Jeugt1-13/+9
2017-11-13Replace "emacs" extension with "amuse" extensionAlexander Krotov1-1/+4
It makes clear that extension is related to Muse markup.
2017-11-12Add emacs extensionAlexander Krotov1-0/+1
2017-10-27Automatic reformating by stylish-haskell.John MacFarlane1-2/+2
2017-10-23Implemented fenced Divs.John MacFarlane1-0/+2
+ 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-09-14FromJSON/ToJSON instances for Reader, WriterOptions.John MacFarlane1-0/+10
Depends on skylighting 0.3.5.
2017-08-19Markdown reader: use CommonMark rules for list item nesting.John MacFarlane1-0/+1
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.
2017-08-08CommonMark reader: support `gfm_auto_identifiers`.John MacFarlane1-1/+3
Added `Ext_gfm_auto_identifiers`: new constructor for `Extension` in `Text.Pandoc.Extensions` [API change]. Use this in githubExtensions. Closes #2821.
2017-08-07Remove GFM modules; use CMarkGFM for both gfm and commonmark.John MacFarlane1-0/+1
We no longer have a separate readGFM and writeGFM; instead, we'll use readCommonMark and writeCommonMark with githubExtensions. It remains to implement these extensions conditionally. Closes #3841.
2017-07-07Rewrote LaTeX reader with proper tokenization.John MacFarlane1-0/+1
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.
2017-06-30Removed `hard_line_breaks` extension from `markdown_github`.John MacFarlane1-1/+0
GitHub has two Markdown modes, one for long-form documents like READMEs and one for short things like issue coments. In issue comments, a line break is treated as a hard line break. In README, wikis, etc., it is treated as a space as in regular Markdown. Since pandoc is more likely to be used to convert long-form documents from GitHub Markdown, `-hard_line_breaks` is a better default. Closes #3594.
2017-06-24Extensions: Monoid instance for Extensions.John MacFarlane1-1/+5
[API change]
2017-06-23Text.Pandoc.Extensions: Added `Ext_raw_attribute`.John MacFarlane1-0/+4
Documented in MANUAL.txt. This is enabled by default in pandoc markdown and multimarkdown.
2017-05-25Added `spaced_reference_links` extension.John MacFarlane1-1/+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-04Include `backtick_code_blocks` extension in `mardkown_mmd`.John MacFarlane1-0/+1
Closes #3637.
2017-04-26API change: move extension handling to Text.Pandoc.ExtensionsAlbert Krewinkel1-4/+74
Extension parsing and processing functions were defined in the top-level Text.Pandoc module. These functions are moved to the Extensions submodule as to enable reuse in other submodules.
2017-03-20Add `space_in_atx_header` extension.John MacFarlane1-0/+3
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-05Markdown reader: fixed internal header links.John MacFarlane1-0/+1
Closes #2397. This patch also adds `shortcut_reference_links` to the list of mmd extensions.
2017-03-04Stylish-haskell automatic formatting changes.John MacFarlane1-2/+3