aboutsummaryrefslogtreecommitdiff
path: root/test/ipynb
AgeCommit message (Collapse)AuthorFilesLines
2021-12-22Add text wrapping to HTML output.John MacFarlane1-4/+8
Previously the HTML writer was exceptional in not being sensitive to the `--wrap` option. With this change `--wrap` now works for HTML. The default (as with other formats) is automatic wrapping to 72 columns. A new internal module, T.P.Writers.Blaze, exports `layoutMarkup`. This converts a blaze Html structure into a doclayout Doc Text. In addition, we now add a line break between an `img` tag and the associated `figcaption`. Note: Output is never wrapped in `writeHtmlStringForEPUB`. This accords with previous behavior since previously the HTML writer was insensitive to `--wrap` settings. There's no real need to wrap HTML inside a zipped container. Note that the contents of script, textarea, and pre tags are always laid out with the `flush` combinator, so that unwanted spaces won't be introduced if these occur in an indented context in a template. Closes #7764.
2021-12-11fix(IpynbOutput)!: rank always favors output formatKolen Cheung2-0/+70
Previously, both `fmt == f` case and Image have a rank of 1. In the end, e.g. from ipynb to html conversion, if both html and image exists, it actually prefers the image. This commit changes this, so that fmt == f is always highest rank, and rank never collides. This is achieved by keeping fmt == f case having rank 1, and every other rank increased by 1.
2021-12-09ipynb writer: handle cell output with raw block of markdown (#7563)Kolen Cheung3-0/+510
Write RawBlock of markdown in code-cell output. #7561 makes the ipynb reader reads code-cell output with mime "text/markdown" to a RawBlock of markdown This commit makes the ipynb writer writes this RawBlock of markdown back inside a code-cell output with the same mime, preserving this information in round-trip Add tests of ipynb reader (#7561) and ipynb writer (#7563)'s ability to handle a "text/markdown" mime type in a code-cell output
2021-12-06Ipynb reader & writer: properly handle cell "id".John MacFarlane3-16/+21
This is passed through if it exists (in Nb4); otherwise the writer will add a random one so that cells all have an "id". Closes #7728.
2021-09-28Switch from pretty-simple to pretty-show for native output.John MacFarlane1-93/+90
Update tests. Reason: it turns out that the native output generated by pretty-simple isn't always readable by the native reader. According to https://github.com/cdepillabout/pretty-simple/issues/99 it is not a design goal of the library that the rendered values be readable using 'read'. This makes it unsuitable for our purposes. pretty-show is a bit slower and it uses 4-space indents (non-configurable), but it doesn't have this serious drawback.
2021-09-21Use pretty-simple to format native output.John MacFarlane1-15/+106
Previously we used our own homespun formatting. But this produces over-long lines that aren't ideal for diffs in tests. Easier to use something off-the-shelf and standard. Closes #7580. Performance is slower by about a factor of 10, but this isn't really a problem because native isn't suitable as a serialization format. (For serialization you should use json, because the reader is so much faster than native.)
2020-07-02Revert "Ipnyb: allow lossless round-tripping of markdown cell content."John MacFarlane1-3/+3
This reverts commit efbc2050315b60c8a753dee6255465f1083019ab.
2020-06-30Ipnyb: allow lossless round-tripping of markdown cell content.John MacFarlane1-3/+3
The reader now parses the contents of the markdown cell to a Pandoc structure, but *also* stores the raw markdown in a `source` attribute on the cell Div. When we convert back to markdown, this attribute is stripped off and the original source is used. When we convert to other formats, the attribute is usually ignored (though it will come through in HTML as a `data-source` attribute, not unhelpfully). I'll note some potential drawbacks of this approach: - It makes it impossible to use pandoc to clean up or change the contents of markdown cells, e.g. going from `+smart` to `-smart`. - There may be formats where the addition of the `source` attribute is problematic. I can't think of any, though. Closes #5408.
2019-03-09Include execution output in ipynb test.John MacFarlane3-6/+25
2019-03-09Ipynb reader/writer: better handling of cell metadata.John MacFarlane3-3/+8
We now handle even complex cell metadata in the Div's attributes. Simple metadata fields are rendered as a plain string, and complex ones as JSON.
2019-02-09Added simple ipynb reader/writer tests.John MacFarlane3-0/+92
Closes #5274.