aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/Markdown.hs
AgeCommit message (Collapse)AuthorFilesLines
2017-05-03Markdown writer: better escaping for links (#3628)David A Roberts1-1/+10
Previously the Markdown writer would sometimes create links where there were none in the source. This is now avoided by selectively escaping bracket characters when they occur in a place where a link might be created. Closes #3619.
2017-05-03Markdown Writer: put space before reference link definitionsMauro Bieg1-1/+1
Fixes #3630 (#3631). Previously the attributes in link reference definitions did not have a space preceding.
2017-05-02Markdown writer: Case-insensitive reference links. (#3616)David A Roberts1-14/+16
Ensure that we do not generate reference links whose labels differ only by case. Also allow implicit reference links when the link text and label are identical up to case. Closes #3615.
2017-03-24Markdown writer: don't emit a simple table if `simple_tables` disabled.John MacFarlane1-9/+9
Closes #3529.
2017-03-21Plain writer: use _(..) or ^(..) for super/subscript...John MacFarlane1-24/+31
...unless unicode super/subscripted characters are available.
2017-03-21Improve rendering of superscript in plain output.John MacFarlane1-13/+29
We now handle a few non digit characters (+, -, =, parentheses) for which there are superscripted unicode characters. Closes #3518.
2017-03-21Moved more gridTable calculations to Writers.Shared.John MacFarlane1-24/+3
2017-03-21Moved gridTable from Markdown writer to Writers.Shared.John MacFarlane1-41/+0
2017-03-11Markdown writer: fixed bugs in simple/multiline list output.John MacFarlane1-10/+9
* Previously we got overlong lists with `--wrap=none`. This is fixed. * Previously a multiline list could become a simple list (and would always become one with `--wrap=none`). Closes #3384.
2017-03-08Markdown writer: Avoid spurious blanklines at end of document...John MacFarlane1-1/+1
after tables and list, for example.
2017-03-08Markdown writer: ensure space before list at top level.John MacFarlane1-22/+31
Closes #3487.
2017-03-08Markdown writer: escape unordered list markers at beginning of paragraphJohn MacFarlane1-12/+20
to avoid false interpretation as a list. Also handle `|`, and refactor code for escaping `%`. Closes #3497.
2017-03-06Markdown writer: better handling of tables with empty columns.John MacFarlane1-12/+22
E.g. an HTML table with two cells in the first row and one in the second (but no row/colspan). We now calculate the number of columns based on the longest row (or the length of aligns or widths). Closes #3337.
2017-03-06Markdown writer: Fixed false ordered lists in YAML metadata.John MacFarlane1-1/+1
Now we properly escape things that would otherwise start ordered lists, such as --- title: 1. inline ... Closes #3492. Closes #1685.
2017-03-05Markdown writer: escape initial % in a paragraph...John MacFarlane1-1/+5
...if the `pandoc_title_blocks` extension is enabled. Otherwise in a document starting with a literal percent sign the first line is wrongly interpreted as a title. Closes #3454.
2017-03-04Fixed some loose ends in #1592.John MacFarlane1-4/+1
Added test cases. Fixed HTML reader to parse a span with class "smallcaps" as SmallCaps. Fixed Markdown writer to render SmallCaps as a native span when native spans are enabled.
2017-03-04Markdown writer: Use span with class 'smallcaps' for SmallCaps.John MacFarlane1-2/+1
Instead of a style attribute as before. See #1592.
2017-03-04Stylish-haskell automatic formatting changes.John MacFarlane1-57/+60
2017-03-02Removed unnecessary import.John MacFarlane1-1/+0
2017-03-01Markdown writer: Fixed grid tables embedded in grid tables.John MacFarlane1-32/+49
Closes #2834.
2017-03-01Markdown writer: Refactored gridTable to use widths in chars.John MacFarlane1-10/+12
2017-02-25Markdown writer: don't include variables in metadata blocks!John MacFarlane1-4/+3
Previously variables set on the command line were included in e.g. YAML metadata, contrary to documentation and intentions.
2017-02-17Added warnings for non-rendered blocks to some writers.John MacFarlane1-5/+10
2017-02-04Markdown writer: Better escaping when +smart.John MacFarlane1-17/+21
2017-02-04Implemented +/-smart in rst writer.John MacFarlane1-12/+0
Moved unsmartify to Writers.Shared.
2017-01-25Provide explicit separate functions for HTML 4 and 5.John MacFarlane1-4/+4
* Text.Pandoc.Writers.HTML: removed writeHtml, writeHtmlString, added writeHtml4, writeHtml4String, writeHtml5, writeHtml5String. * Removed writerHtml5 from WriterOptions. * Renamed default.html template to default.html4. * "html" now aliases to "html5"; to get the old HTML4 behavior, you must now specify "-t html4".
2017-01-25Revert "Added page breaks into Pandoc."John MacFarlane1-1/+0
This reverts commit f02a12aff638fa2339192231b8f601bffdfe3e14.
2017-01-25Removed writerIgnoreNotes.John MacFarlane1-5/+5
Instead, just temporarily remove notes when generating TOC lists in HTML and Markdown (as we already did in LaTeX). Also export deNote from Text.Pandoc.Shared. API change in Shared and Options.WriterOptions.
2017-01-25Make the `smart` extension affect the Markdown writer.John MacFarlane1-6/+29
Thus, to "unsmartify" something that has been parsed as smart by pandoc, you can use `-t markdown+smart`, and straight quotes will be produced instead of curly quotes, etc. Example: % pandoc -f latex -t markdown+smart ``hi''---ok ^D "hi"---ok
2017-01-25Fixed something small that broke in rebase.John MacFarlane1-1/+1
2017-01-25Remove now-unnecessary lifts in Markdown writer.John MacFarlane1-9/+6
Other writers still TBD.
2017-01-25Refactored math conversion in writers.John MacFarlane1-9/+13
* Remove exported module `Text.Pandoc.Readers.TeXMath` * Add exported module `Text.Pandoc.Writers.Math` * The function `texMathToInlines` now lives in `Text.Pandoc.Writers.Math` * Export helper function `convertMath` from `Text.Pandoc.Writers.Math` * Use these functions in all writers that do math conversion. This ensures that warnings will always be issued for failed math conversions.
2017-01-25Unify Errors.Jesse Rosenthal1-1/+2
2017-01-25Implement Errors in PandocMonadJesse Rosenthal1-9/+10
Errors can be thrown purely with `throwError`. At the moment there are only three kinds of errors: 1. PandocFileReadError FilePath (for problems reading a file from the filesystem) 2. PandocShouldNeverHappenError String (for stuff that should never happen but we need to pattern-match anyway) 3. PandocSomeError String (a grab bag of everything else) Of course, we need to subdivide the third item in this list.
2017-01-25Convert all writers to use PandocMonad.Jesse Rosenthal1-41/+48
Since PandocMonad is an instance of MonadError, this will allow us, in a future commit, to change all invocations of `error` to `throwError`, which will be preferable for the pure versions. At the moment, we're disabling the lua custom writers (this is temporary). This requires changing the type of the Writer in Text.Pandoc. Right now, we run `runIOorExplode` in pandoc.hs, to make the conversion easier. We can switch it to the safer `runIO` in the future. Note that this required a change to Text.Pandoc.PDF as well. Since running an external program is necessarily IO, we can be clearer about using PandocIO.
2017-01-25Adds support for pagebreaks (when it makes sense)Hubert Plociniczak1-1/+2
Update all writers to take into account page breaks. A straightforwad, far from complete, implementation of page breaks in selected writers. Readers will have to follow in the future as well.
2016-12-11Fix display math with --webtex in markdown output.John MacFarlane1-9/+13
Closes #3298.
2016-12-04Markdown writer: Fixed incorrect word wrapping.John MacFarlane1-1/+1
Previously pandoc would sometimes wrap lines too early due to this bug. Closes #3277.
2016-11-30Options: Removed writerStandalone, made writerTemplate a Maybe.John MacFarlane1-14/+14
Previously setting writerStandalone = True did nothing unless a template was provided in writerTemplate. Now a fragment will be generated if writerTemplate is Nothing; otherwise, the specified template will be used and standalone output generated. [API change]
2016-11-19Fix for calculation of column widths for aligned multiline tablesBjörn Peemöller1-8/+20
This also fixes excessive CPU and memory usage for tables when --columns is set in such a way that cells must be very tiny. Now cells are guaranteed to be big enough so that single words don't need to line break, even if this pushes the line length above the column width. Closes #1911.
2016-11-18Markdown writer: Use bracketed form for native spans...John MacFarlane1-4/+11
...when `bracketed_spans` enabled. Closes #3229.
2016-11-15Adjust widths in Markdown grid tables so that they match on round-trip.John MacFarlane1-1/+1
2016-11-15Allow alignments to be specified in Markdown grid tables.John MacFarlane1-9/+29
2016-11-15Markdown writer: fixed inconsistent spacing issue.John MacFarlane1-12/+20
Previously a tight bullet sublist got rendered with a blank line after, while a tight ordered sublist did not. Now we don't get the blank line in either case. Closes #3232.
2016-11-12Markdown writer: Fix escaping of spaces in super/subscript.John MacFarlane1-37/+39
Previously two backslashes were inserted, which gave a literal backslash. Closes #3225.
2016-10-13Markdown writer: Abstract out note/ref function.Jesse Rosenthal1-28/+22
We do basically the same thing every time we insert notes, so let's cut down on code duplication.
2016-10-13Add support for the LineBlock element to writersAlbert Krewinkel1-1/+7
The following markup features are used to output the lines of the `LineBlock` element: - AsciiDoc: a `[verse]` block, - ConTeXt: text surrounded by `\startlines` and `\endlines`, - HTML: `div` with an per-element style setting to interpret the content as pre-wrapped, - Markdown: line blocks if the `line_blocks` extension is enabled, a simple paragraph with hard linebreaks otherwise, - Org: VERSE block, - RST: a line block, and - all other formats: a paragraph, containing hard linebreaks between lines. Custom lua writers should be updated to use the `LineBlock` element.
2016-10-11Markdown writer: Allow footnotes/refs at the end of blocks, sectionsJesse Rosenthal1-21/+64
This allows footnotes and refs to be placed at the end of blocks and sections. Note that we only place them at the end of blocks that are at the top level and before headers that are the top level. We add an environment variable to keep track of this. Because we clear the footnotes and refs when we use them, we also add a state variable to keep track of the starting number. Finally, note that we still add any remaining footnotes at the end. This takes care of the final section, if we are placing at the end of a section, and will always come after a final block as well.
2016-10-11Add ReaderT monad for environment variables.Jesse Rosenthal1-64/+78
This will make it easier to keep track of what level of block we are at.
2016-10-10More checks for Ext_raw_html when rendering HTML in Markdown.John MacFarlane1-5/+9
Previously we'd emit raw HTML tables even if the `raw_html` extension was disabled. Now we just emit `[TABLE]` if no table formats are enabled and raw HTML is not enabled. We also check for the `raw_html` extension before emiting a raw HTML block. Closes #3154.