aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Extensions.hs
AgeCommit message (Collapse)AuthorFilesLines
2021-03-15Use foldl' instead of foldl everywhere.John MacFarlane1-1/+2
2021-02-13Org: support task_lists extensionAlbert Krewinkel1-0/+2
The tasks lists extension is now supported by the org reader and writer; the extension is turned on by default. Closes: #6336
2021-02-13Remove Ext_fenced_code_attributes from allowed commonmark attributes.John MacFarlane1-2/+0
This attribute was listed as allowed, but it didn't actually do anything. Use `attributes` for code attributes and more. Closes #7097.
2021-01-22JATS writer: allow to use element-citationAlbert Krewinkel1-0/+14
2021-01-16Revert "Markdown reader: support GitHub wiki's internal links (#2923) (#6458)"John MacFarlane1-3/+0
This reverts commit 6efd3460a776620fdb93812daa4f6831e6c332ce. Since this extension is designed to be used with GitHub markdown (gfm), we need to implement the parser as a commonmark extension (commonmark-extensions), rather than in pandoc's markdown reader. When that is done, we can add it here.
2021-01-16Markdown reader: support GitHub wiki's internal links (#2923) (#6458)Gautier DI FOLCO1-0/+3
Canges overview: * Add a `Ext_markdown_github_wikilink` constructor to `Extension` [API change]. * Add the parser `githubWikiLink` in `Text.Pandoc.Readers.Markdown` * Add tests.
2021-01-08Update copyright notices for 2021 (#7012)Albert Krewinkel1-1/+1
2020-12-10Add sourcepos extension for commonmarkeJohn MacFarlane1-0/+2
* Add `Ext_sourcepos` constructor for `Extension`. * Add `sourcepos` extension (only for commonmark). * Bump to 2.11.3 With the `sourcepos` extension set set, `data-pos` attributes are added to the AST by the commonmark reader. No other readers are affected. The `data-pos` attributes are put on elements that accept attributes; for other elements, an enlosing Div or Span is added to hold the attributes. Closes #4565.
2020-12-05OpenDocument writer: Allow references for internal links (#6774)Nils Carlson1-0/+4
This commit adds two extensions to the OpenDocument writer, `xrefs_name` and `xrefs_number`. Links to headings, figures and tables inside the document are substituted with cross-references that will use the name or caption of the referenced item for `xrefs_name` or the number for `xrefs_number`. For the `xrefs_number` to be useful heading numbers must be enabled in the generated document and table and figure captions must be enabled using for example the `native_numbering` extension. In order for numbers and reference text to be updated the generated document must be refreshed. Co-authored-by: Nils Carlson <nils.carlson@ludd.ltu.se>
2020-11-20`commonmark_x`: replace `auto_identifiers` with `gfm_auto_identifiers`.John MacFarlane1-3/+4
`commonmark_x` never actually supported `auto_identifiers` (it didn't do anything), because the underlying library implements gfm-style identifiers only. Attempts to add the `autolink_identifiers` extension to `commonmark` will now fail with an error. Closes #6863.
2020-09-25Allow `gfm_auto_identifiers`, `ascii_identifiers` extensions for docx.John MacFarlane1-1/+1
2020-08-09Remove `fenced_code_blocks` and `backtick_code_blocks` from...John MacFarlane1-5/+11
commonmark/gfm extensions. These shouldn't really be counted as extensions, because they can't be disabled in commonmark. Adjust markdown writer to check for commonmark variant in addition to extensions.
2020-07-29Add extensions to `gfm` and `commonmark`:John MacFarlane1-0/+8
`fenced_code_blocks`, `backtick_code_blocks`, `fenced_code_attributes`. These can't really be disabled in the reader, but they need to be enabled in the writer or we just get indented code.
2020-07-24Make sure proper set of extensions is recognized for commonmark_x.John MacFarlane1-0/+1
2020-07-23Add `raw_markdown` extension affecting `ipynb` reader.John MacFarlane1-1/+3
Specifying `-f ipynb+raw_markdown` will cause Markdown cells to be represented as raw Markdown blocks, instead of being parsed. This is not what you want when going from `ipynb` to other formats, but it may be useful when going from `ipynb` to Markdown or to `ipynb`, to avoid semantically insignificant changes in the contents of the Markdown cells that might otherwise be introduced. Closes #5408.
2020-07-19Remove use of cmark-gfm for commonmark/gfm rendering.John MacFarlane1-0/+1
Instead rely on the markdown writer with appropriate extensions. Export writeCommonMark variant from Markdown writer. This changes a few small things in rendering markdown, e.g. w/r/t requiring backslashes before spaces inside super/subscripts.
2020-07-19Add commonmark_x output format...John MacFarlane1-3/+31
commonmark with a number of useful extensions (more than gfm).
2020-07-19Trim down githubMarkdownExtensions.John MacFarlane1-9/+11
Previously it included all of the following, which make sense for the legacy markdown_github but not for gfm, since they are part of base commonmark and thus can't be turned off in gfm: - `Ext_all_symbols_escapable` - `Ext_backtick_code_blocks` - `Ext_fenced_code_blocks` - `Ext_space_in_atx_header` - `Ext_intraword_underscores` - `Ext_lists_without_preceding_blankline` - `Ext_shortcut_reference_links` ` These have been removed from `githubMarkdownExtensions`, though they're still turned on for legacy `markdown_github`.
2020-07-19Add generic `attributes` extension.John MacFarlane1-4/+2
This allows attributes to be added to any block or inline element, in principle. (Though in many cases this will be done by adding a Div or Span container, since pandoc's AST doesn't have a slot for attributes for most elements.) Currently this is only possible with the commonmark and gfm readers. Add `Ext_attributes` constructor for `Extension` [API change].
2020-07-19Use commonmark-hs to parse commonmark/gfm...John MacFarlane1-0/+14
...instead of cmark-gfm (a wrapper around a C library). We can now support many more pandoc extensions for commonmark and gfm. Add fenced_code_attributes to gfm/commonmark extensions.
2020-05-08Implement implicit_figures extension for commonmark reader.John MacFarlane1-0/+1
Closes #6350.
2020-03-15Use implicit Prelude (#6187)Albert Krewinkel1-2/+0
* Use implicit Prelude The previous behavior was introduced as a fix for #4464. It seems that this change alone did not fix the issue, and `stack ghci` and `cabal repl` only work with GHC 8.4.1 or newer, as no custom Prelude is loaded for these versions. Given this, it seems cleaner to revert to the implicit Prelude. * PandocMonad: remove outdated check for base version Only base versions 4.9 and later are supported, the check for `MIN_VERSION_base(4,8,0)` is therefore unnecessary. * Always use custom prelude Previously, the custom prelude was used only with older GHC versions, as a workaround for problems with ghci. The ghci problems are resolved by replacing package `base` with `base-noprelude`, allowing for consistent use of the custom prelude across all GHC versions.
2020-03-13Update copyright year (#6186)Albert Krewinkel1-1/+1
* Update copyright year * Copyright: add notes for Lua and Jira modules
2019-11-29Add `ascii_identifiers` as a supported extension for `markdown`.John MacFarlane1-27/+25
This fixes a regression in 2.8.
2019-11-16Add `Ext_smart` to list of possible extensions for HTML.John MacFarlane1-0/+1
2019-11-12Switch to new pandoc-types and use Text instead of String [API change].despresc1-5/+7
PR #5884. + Use pandoc-types 1.20 and texmath 0.12. + Text is now used instead of String, with a few exceptions. + In the MediaBag module, some of the types using Strings were switched to use FilePath instead (not Text). + In the Parsing module, new parsers `manyChar`, `many1Char`, `manyTillChar`, `many1TillChar`, `many1Till`, `manyUntil`, `mantyUntilChar` have been added: these are like their unsuffixed counterparts but pack some or all of their output. + `glob` in Text.Pandoc.Class still takes String since it seems to be intended as an interface to Glob, which uses strings. It seems to be used only once in the package, in the EPUB writer, so that is not hard to change.
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