Age | Commit message (Collapse) | Author |
|
Introduce multi-purpose data/len members in struct cmark_node. This
is mainly used to store literal text for inlines, code and HTML blocks.
Move the content strbuf for blocks from cmark_node to cmark_parser.
When finalizing nodes that allow inlines (paragraphs and headings),
detach the strbuf and store the block content in the node's data/len
members. Free the block content after processing inlines.
Reduces size of struct cmark_node by 8 bytes.
|
|
|
|
Closes #290.
|
|
Removes CMARK_OPT_SAFE from options.
Adds CMARK_OPT_UNSAFE, with the opposite meaning.
The new default behavior is to suppress raw HTML and
potentially dangerous links. The CMARK_OPT_UNSAFE
option has to be set explicitly to prevent this.
--------------------------------------------------------
NOTE: This change will require modifications in
bindings for cmark and in most libraries and programs
that use cmark.
--------------------------------------------------------
Closes #239, #273.
Borrows heavily from @kivikakk's patch in github/cmark-gfm#123.
|
|
|
|
|
|
This option was added in 04726a7 (Added `CMARK_OPT_VALIDATE_UTF8`
option. - 2015-06-16) but not "documented".
|
|
|
|
This reverts commit 4fbe344df43ed7f60a3d3a53981088334cb709fc.
|
|
* Improve strbuf guarantees
Introduce BUFSIZE_MAX macro and make sure that the strbuf implementation
can handle strings up to this size.
* Abort early if document size exceeds internal limit
* Change types for source map offsets
Switch to size_t for the public API, making the public headers
C89-compatible again.
Switch to bufsize_t internally, reducing memory usage and improving
performance on 32-bit platforms.
* Make parser return NULL on internal index overflow
Make S_parser_feed set an error and ignore subsequent chunks if the
total input document size exceeds an internal limit. Make
cmark_parser_finish return NULL if an error was encountered. Add
public API functions to retrieve error code and error message.
strbuf overflow in renderers and OOM in parser or renderers still
cause an abort.
|
|
|
|
|
|
|
|
I thought I had an outdated version of the binary because it printed 2015 for
the version string.
|
|
- Extend CMARK_OPT_NOBREAKS to all renderers and add `--nobreaks`.
- Do not autowrap, regardless of width parameter, if CMARK_OPT_NOBREAKS
is set.
- Fixed CMARK_OPT_HARDBREAKS for LaTeX and man renderers.
- Ensure that no auto-wrapping occurs if CMARK_OPT_NOBREAKS is enabled,
or if output is CommonMark and CMARK_OPT_HARDBREAKS is enabled.
- Updated man pages.
|
|
Set stdin to binary mode on Windows
|
|
Fixes EOLs when reading from stdin.
Fully fixes issue #113.
|
|
Now that cmark supports different line endings, files must be openend
in binary mode on Windows.
Fixes issue #113.
|
|
|
|
* Reformatted all source files.
* Added 'format' target to Makefile.
* Removed 'astyle' target.
* Updated .editorconfig.
|
|
* Added `CMARK_OPT_SAFE`. This option disables rendering of raw HTML
and potentially dangerous links.
* Added `--safe` option in command-line program.
* Updated `cmark.3` man page.
* Added `scan_dangerous_url` to scanners.
* In HTML, suppress rendering of raw HTML and potentially dangerous
links if `CMARK_OPT_SAFE`. Dangerous URLs are those that begin
with `javascript:`, `vbscript:`, `file:`, or `data:` (except for
`image/png`, `image/gif`, `image/jpeg`, or `image/webp` mime types).
* Added `api_test` for `OPT_CMARK_SAFE`.
* Rewrote `README.md` on security.
|
|
Rewrote man.c using new renderer framework.
|
|
(It uses GNU extensions, and we don't need it anyway.)
|
|
* New exported function in API: `cmark_render_latex`.
* Added src/latex.hs.
* Updated README and man page.
* Closes #31.
|
|
Also command line option `--validate-utf8`.
This option causes cmark to check for valid UTF-8,
replacing invalid sequences with the replacement
character, U+FFFD.
Reinstated api tests for utf8.
|
|
|
|
|
|
|
|
This controls column width for hard wrapping. By default it is
0, which means that no wrapping will be done.
Added a width parameter in `cmark_render_commonmark`.
|
|
This is still incomplete. (See TODOs in the source.)
|
|
|
|
For consistency with the API.
|
|
|
|
Also to some non-exported functions in blocks and inlines.
|
|
|
|
So far this is only implemented for the HTML renderer.
Ultimately some of this should be factored out into a form that
can be used in other renderers.
|
|
Add version number and string as macros and symbols. Version numbers can
be easily compared, for example in the C preprocessor:
#include <cmark.h>
#if CMARK_VERSION < 0x020200
#error Requires libcmark 2.2.0 or higher
#endif
Storing the version in a global variable allows to check the library
version at runtime. For example:
if (CMARK_VERSION != cmark_version) {
warn("Compiled against libcmark %s, but using %s",
CMARK_VERSION_STRING, cmark_version_string);
}
The version should be updated whenever the public API is changed.
|
|
So, instead of
<text>Hi</text>
<text>&</text>
<text>lo</text>
we get
<text>Hi&lo</text>
* Added exported `cmark_consolidate_text_nodes` function.
* Added `CMARK_OPT_NORMALIZE` to options.
* Added optional normalization in XML writer.
* Added `--normalize` option to command-line program.
* Updated man page.
|
|
|
|
This fixes the output of newlines.
|
|
To keep the API simple and avoid API changes when new options are
added, this is just a long integer.
Set it by disjoining options that are defined as powers of 2: e.g.
`CMARK_HTML_SOURCEPOS | CMARK_HTML_HARDREAKS`.
Test options using `&`: `if (options & CMARK_HTML_SOURCEPOS)`.
Added `--hardbreaks` and `--sourcepos` command-line options.
|
|
The xml representation of the AST is not quite as pretty, but
it contains the same information and is not in an ad hoc format.
See #53.
|
|
This is a work-in-progress.
CommonMark.dtd gives the DTD for the generated XML.
Closes #53.
|
|
cmark: Replaced `--man` and `--ast` with generic `--to` option.
|
|
Fixes issue with Ctrl-D having to be pressed twice when reading from
terminal.
|
|
|
|
Replace cmark_parser_process_line with cmark_parser_push that takes
arbitrary chunks of data. Also fixes #211.
|
|
Replace it with static S_free_nodes.
|
|
cmark_doc_parser => cmark_parser
cmark_new_doc_parser => cmark_parser_new
cmark_free_doc_parser => cmark_parser_free
cmark_finish => cmark_parser_finish
cmark_process_line => cmark_parser_process_line
cmark_node_destroy => cmark_node_free
Closes #223.
|
|
This returns a string.
|