aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/Markdown.hs
AgeCommit message (Collapse)AuthorFilesLines
2017-08-13Markdown writer: Use pipe tables if `raw_html` disabled...John MacFarlane1-2/+10
and `pipe_tables` enabled, even if the table has relative width information. Closes #3734.
2017-07-30Markdown writer: better escaping of `<` and `>`.John MacFarlane1-2/+6
If `all_symbols_escapable` is set, we backslash escape these. Otherwise we use entities as before.
2017-06-30Markdown writer: Ensure that `+` and `-` are escaped properly...John MacFarlane1-0/+3
so they don't cause spurious lists. Previously they were only if succeeded by a space, not if they were at end of line. Closes #3773.
2017-06-26Use `table-of-contents` for contents of toc, make `toc` a boolean.John MacFarlane1-3/+7
Changed markdown, rtf, and HTML-based templates accordingly. This allows you to set `toc: true` in the metadata; this previously produced strange results in some output formats. Closes #2872. For backwards compatibility, `toc` is still set to the toc contents. But it is recommended that you update templates to use `table-of-contents` for the toc contents and `toc` for a boolean flag.
2017-06-23Markdown writer: make sure `plain`, `markdown_github`, etc. work for raw.John MacFarlane1-5/+9
Previously only `markdown` worked. Note: currently a raw block labeled `markdown_github` will be printed for any `markdown` format.
2017-06-20Writers: adjusted for renderTemplate' changes.John MacFarlane1-1/+1
Now we raise a proper error on template failure.
2017-06-17Use Control.Monad.State.Strict throughout.John MacFarlane1-1/+1
This gives 20-30% speedup and reduction of memory usage in most of the writers.
2017-06-12Markdown writer: don't allow soft break in header.John MacFarlane1-0/+7
Closes #3736.
2017-06-11Switched Writer types to use Text.John MacFarlane1-10/+13
* XML.toEntities: changed type to Text -> Text. * Shared.tabFilter -- fixed so it strips out CRs as before. * Modified writers to take Text. * Updated tests, benchmarks, trypandoc. [API change] Closes #3731.
2017-06-01Markdown writer: Avoid inline surround-marking with empty content.John MacFarlane1-0/+5
E.g. we don't want `<strong></strong>` to become `****`. Similarly for emphasis, super/subscript, strikeout. Closes #3715.
2017-05-27Markdown writer: changes to `--reference-links`.John MacFarlane1-15/+44
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-23Shared: Provide custom isURI that rejects unknown schemes [isURI]Albert Krewinkel1-1/+0
We also export the set of known `schemes`. The new function replaces the function of the same name from `Network.URI`, as the latter did not check whether a scheme is well-known. E.g. MediaWiki wikis frequently feature pages with names like `User:John`. These links were interpreted as URIs, thus turning internal links into global links. This is prevented by also checking whether the scheme of a URI is frequently used (i.e. is IANA registered or an otherwise well-known scheme). Fixes: #2713 Update set of well-known URIs from IANA list All official IANA schemes (as of 2017-05-22) are included in the set of known schemes. The four non-official schemes doi, isbn, javascript, and pmid are kept.
2017-05-17Markdown writer: Fixed duplicated reference linksJohn MacFarlane1-11/+15
with `--reference-links` and `--reference-location=section`. Also ensure that there are no empty link references `[]`. Closes #3674.
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-07Markdown writer: missing \n (#3647)David A Roberts1-1/+1
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.