aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/Markdown.hs
AgeCommit message (Collapse)AuthorFilesLines
2021-06-28Markdown writer: put space between Plain and following fenced Div.John MacFarlane1-0/+3
Closes #4465.
2021-06-21Markdown writer: Fix regression in code blocks with attributes.John MacFarlane1-3/+3
Code blocks with a single class but nonempty attributes were having attributes drop as a result of #7242. Closes #7397.
2021-06-12Markdown writer: allow `pipe_tables` to be disabled for commonmark...John MacFarlane1-1/+0
(commonmark_x, gfm). Closes #7375.
2021-06-05CommonMark writer: do not use simple class for fenced-divsJan Tojnar1-3/+6
In https://github.com/jgm/pandoc/pull/7242, we introduced a simple attribute style for for code blocks and fenced divs with a single class but turns out the CommonMark extension does not support it for fenced divs. https://github.com/jgm/commonmark-hs/blob/master/commonmark-extensions/test/fenced_divs.md
2021-06-05CommonMark writer: do not throw away attributes when Ext_attributes is enabledJan Tojnar1-3/+5
Ext_attributes covers at least the following: - Ext_fenced_code_attributes - Ext_header_attributes - Ext_inline_code_attributes - Ext_link_attributes
2021-06-05Markdown writer: re-use functions from InlineJan Tojnar1-28/+1
Instead of duplicating linkAttributes and attrsToMarkdown, let’s just use those from the Inline module.
2021-04-25Markdown writer: Cleaner (code)blocks with single class (#7242)Jan Tojnar1-2/+8
When a block only has a single class and no other attributes, it is not necessary to wrap the class attribute in curly braces – the class name can be placed after the opening mark as is. This will result in bit cleaner output when pandoc is used as a markdown pretty-printer.
2021-04-25Add quotes properly in markdown YAML metadata fields.John MacFarlane1-6/+5
This fixes a bug, which caused the writer to look at the LAST rather than the FIRST character in determining whether quotes were needed. So we got spurious quotes in some cases and didn't get necessary quotes in others. Closes #7245. Updated a number of test cases accordingly.
2021-04-05Commonmark writer: Use backslash escapes for `<` and `|`...John MacFarlane1-1/+11
instead of entities. Closes #7208.
2021-03-19Protect partial uses of maximum with NonEmpty.John MacFarlane1-17/+20
2021-03-02Split up T.P.Writers.Markdown...John MacFarlane1-591/+6
with T.P.Writers.Markdown.Types and T.P.Writers.Markdown.Inline. The module was difficult to compile on low-memory system.s
2021-02-26Fix/update URLs and use HTTP**S** where possible (#7122)Salim B1-1/+1
2021-01-29Markdown writer: handle math right before digit.John MacFarlane1-1/+5
We insert an HTML comment to avoid a `$` right before a digit, which pandoc will not recognize as a math delimiter.
2021-01-12Markdown writer: cleaned up raw formats.John MacFarlane1-34/+35
We now react appropriately to gfm, commonmark, and commonmark_x as raw formats.
2021-01-08Update copyright notices for 2021 (#7012)Albert Krewinkel1-1/+1
2021-01-07gfm/commonmark writer: implement start number on ordered lists.John MacFarlane1-1/+4
Previously they always started at 1, but according to the spec the start number is respected. Closes #7009.
2020-12-15Properly handle boolean values in writing YAML metadata.John MacFarlane1-0/+2
(Markdown writer.) This requires doctemplates >= 0.9. Closes #6388.
2020-12-04Markdown writer: ensure that a new csl-block begins on a new line.John MacFarlane1-1/+6
This just looks better and doesn't affect the semantics. See #6921.
2020-11-14Markdown writer: default to using ATX headings.Aner Lucero1-1/+6
Previously we used Setext (underlined) headings by default. The default is now ATX (`##` style). * Add the `--markdown-headings=atx|setext` option. * Deprecate `--atx-headers`. * Add constructor 'ATXHeadingInLHS` constructor to `LogMessage` [API change]. * Support `markdown-headings` in defaults files. * Document new options in MANUAL. Closes #6662.
2020-10-23Commonmark writer: fix regression with fenced divs.John MacFarlane1-1/+3
Starting with 2.10.1, fenced divs no longer render with HTML div tags in commonmark output. This is a regression due to our transition from cmark-gfm. This commit fixes it. Closes #6768.
2020-10-12Markdown writer: Fix autolinks rendering for gfm.John MacFarlane1-24/+23
Previously, autolinks rendered as raw HTML, due to the `class="uri"` added by pandoc's markdown reader. Closes #6740.
2020-10-08Be less aggressive about using quotes for YAML values.John MacFarlane1-4/+11
We need quotes if `[` or `{` or `'` is at the beginning of the line, but not otherwise.
2020-10-07Use double quotes for YAML metadata.John MacFarlane1-2/+2
Closes #6727.
2020-09-21Sort YAML metadata keys in Markdown output case-insensitive.John MacFarlane1-2/+2
Use caseFold.
2020-09-13Fix hlint suggestions, update hlint.yaml (#6680)Christian Despres1-52/+49
* Fix hlint suggestions, update hlint.yaml Most suggestions were redundant brackets. Some required LambdaCase. The .hlint.yaml file had a small typo, and didn't ignore camelCase suggestions in certain modules.
2020-08-09Remove `fenced_code_blocks` and `backtick_code_blocks` from...John MacFarlane1-6/+12
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-23Markdown writer: use numerical labels for refs...John MacFarlane1-5/+9
...that are longer than 999 characters or contain square brackets. For conformity with commonmark. Closes #6560
2020-07-23Add `raw_markdown` extension affecting `ipynb` reader.John MacFarlane1-2/+2
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-19Markdown writer: move asciify out of escapeString.John MacFarlane1-9/+9
Otherwise unsmartify doesn't catch quotes that have already been turned to entities.
2020-07-19Remove use of cmark-gfm for commonmark/gfm rendering.John MacFarlane1-80/+95
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-19Markdown writer: use unicode super/subscript characters...John MacFarlane1-18/+44
when possible if the superscript or subscript extension or raw_html aren't available.
2020-07-19Markdown writer: render caption as following paragraph...John MacFarlane1-2/+5
when `Ext_table_caption` not enabled.
2020-04-28Support new Underline element in readers and writers (#6277)Vaibhav Sagar1-0/+15
Deprecate `underlineSpan` in Shared in favor of `Text.Pandoc.Builder.underline`.
2020-04-17Markdown writer: avoid unnecessary escapes before intraword `_`John MacFarlane1-1/+6
when `intraword_underscores` extension is enabled. Closes #6296.
2020-04-15Adapt to the newest Table type, fix some previous adaptation issuesdespresc1-1/+1
- Writers.Native is now adapted to the new Table type. - Inline captions should now be conditionally wrapped in a Plain, not a Para block. - The toLegacyTable function now lives in Writers.Shared.
2020-04-15Remove the onlySimpleCellBodies function from Shareddespresc1-1/+1
2020-04-15Implement the new Table typedespresc1-2/+3
2020-03-31Markdown writer: ensure consistent padding for pipe tables.John MacFarlane1-2/+2
Previously there was no space between text and bar in right-aligned table cells. This commit also ensures space on both sides for centered cells. Closes #6240.
2020-03-29Clean up some fmaps (#6226)Joseph C. Sible1-2/+2
* Avoid fmapping when we're just binding right after anyway * Clean up unnecessary fmaps in the LaTeX reader
2020-03-22Finer grained imports of Text.Pandoc.Class submodules (#6203)Albert Krewinkel1-1/+1
This should speed-up recompilation after changes in `Text.Pandoc.Class`, as the number of modules affected by a change will be smaller in general. It also offers faster insights into the parts of `T.P.Class` used within a module.
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
2020-02-10Fix spurious dots in markdown_mmd metadata outputJohn MacFarlane1-1/+1
Closes #6133 (regression).
2020-02-07Resolve HLint warningsAlbert Krewinkel1-8/+8
All warnings are either fixed or, if more appropriate, HLint is configured to ignore them. HLint suggestions remain. * Ignore "Use camelCase" warnings in Lua and legacy code * Fix or ignore remaining HLint warnings * Remove redundant brackets * Remove redundant `return`s * Remove redundant as-pattern * Fuse mapM_/map * Use `.` to shorten code * Remove redundant `fmap` * Remove unused LANGUAGE pragmas * Hoist `not` in Text.Pandoc.App * Use fewer imports for `Text.DocTemplates` * Remove redundant `do`s * Remove redundant `$`s * Jira reader: remove unnecessary parentheses
2020-02-07Various minor cleanups and refactoring (#6117)Joseph C. Sible1-11/+10
* Use concatMap instead of reimplementing it * Replace an unnecessary multi-way if with a regular if * Use sortOn instead of sortBy and comparing * Use guards instead of lots of indents for if and else * Remove redundant do blocks * Extract common functions from both branches of maybe Whenever both the Nothing and the Just branch of maybe do the same function, do that function on the result of maybe instead. * Use fmap instead of reimplementing it from maybe * Use negative forms instead of negating the positive forms * Use mapMaybe instead of mapping and then using catMaybes * Use zipWith instead of mapping over the result of zip * Use unwords instead of reimplementing it * Use <$ instead of <$> and const * Replace case of Bool with if and else * Use find instead of listToMaybe and filter * Use zipWithM instead of mapM and zip * Inline lambda wrappers into the real functions * We get zipWithM from Text.Pandoc.Writers.Shared * Use maybe instead of fromMaybe and fmap I'm not sure how this one slipped past me. * Increase a bit of indentation
2020-02-03Swap suboptimal uses of maybe and fromMaybe (#6111)Joseph C. Sible1-3/+3
Anywhere "maybe" is used with "id" as its second argument, using "fromMaybe" instead will simplify the code. Conversely, anywhere "fromMaybe" is used with the result of "fmap" or "<$>" as its second argument, using "maybe" instead will simplify the code.
2019-12-17Improved --toc generation.John MacFarlane1-2/+1
2019-11-19Improve markdown escaping in list items.John MacFarlane1-27/+25
Closes #5918.
2019-11-12Switch to new pandoc-types and use Text instead of String [API change].despresc1-201/+200
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-29Changes to build with new doctemplates/doclayout.John MacFarlane1-4/+4
The new version of doctemplates adds many features to pandoc's templating system, while remaining backwards-compatible. New features include partials and filters. Using template filters, one can lay out data in enumerated lists and tables. Templates are now layout-sensitive: so, for example, if a text with soft line breaks is interpolated near the end of a line, the text will break and wrap naturally. This makes the templating system much more suitable for programatically generating markdown or other plain-text files from metadata.