summaryrefslogtreecommitdiff
path: root/src/main.c
AgeCommit message (Collapse)Author
2020-09-02add support for groff mom filterKatolaZ
2020-06-22Re-add `--safe` command-line option as a no-op.John MacFarlane
See #344.
2020-01-23Rearrange struct cmark_nodeNick Wellnhofer
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.
2019-07-05print_usage(): Minor grammar fix, swap two words (#305)Øyvind A. Holm
2019-03-28Remove leftover includes of memory.h.John MacFarlane
Closes #290.
2019-03-17Make rendering safe by default.John MacFarlane
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.
2018-11-21check for OpenBSD 5.9+Ashe Connor
2018-11-20Use pledge(2) on OpenBSDAshe Connor
2017-08-01Advertise --validate-utf8 in usage informationNguyễn Thái Ngọc Duy
This option was added in 04726a7 (Added `CMARK_OPT_VALIDATE_UTF8` option. - 2015-06-16) but not "documented".
2017-05-05Remove normalize as an option per #190 (#194)Yuki Izumi
2017-01-03Revert "Change types for source map offsets (#174)"John MacFarlane
This reverts commit 4fbe344df43ed7f60a3d3a53981088334cb709fc.
2016-12-30Change types for source map offsets (#174)Nick Wellnhofer
* 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.
2016-09-27One more cmark_mem useYuki Izumi
2016-06-06cmark: Implement support for custom allocatorsVicent Marti
2016-06-06cmake: Global handler for OOM situationsVicent Marti
2016-05-26Add 2016 to copyrightKevin Burke
I thought I had an outdated version of the binary because it printed 2015 for the version string.
2016-04-09Fixed a number of issues relating to line wrapping.John MacFarlane
- 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.
2016-03-27Merge pull request #118 from nwellnhof/win-eol-fix2John MacFarlane
Set stdin to binary mode on Windows
2016-03-27Set stdin to binary mode on WindowsNick Wellnhofer
Fixes EOLs when reading from stdin. Fully fixes issue #113.
2016-03-26Open files in binary modeNick Wellnhofer
Now that cmark supports different line endings, files must be openend in binary mode on Windows. Fixes issue #113.
2015-12-19Removed bench.h and timing calls in main.cJohn MacFarlane
2015-07-27Use clang-format, llvm style, for formatting.John MacFarlane
* Reformatted all source files. * Added 'format' target to Makefile. * Removed 'astyle' target. * Updated .editorconfig.
2015-07-13Added `CMARK_OPT_SAFE` option and `--safe` command-line flag.John MacFarlane
* 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.
2015-07-12Added width parameter to render_man.John MacFarlane
Rewrote man.c using new renderer framework.
2015-07-11Removed dependence on debug.h.John MacFarlane
(It uses GNU extensions, and we don't need it anyway.)
2015-07-05Added LaTeX renderer.John MacFarlane
* New exported function in API: `cmark_render_latex`. * Added src/latex.hs. * Updated README and man page. * Closes #31.
2015-06-16Added `CMARK_OPT_VALIDATE_UTF8` option.John MacFarlane
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.
2015-04-19astyle reformatting.John MacFarlane
2015-03-30Modified copyright message with --version.John MacFarlane
2015-03-22Initialize width.John MacFarlane
2015-03-21CommonMark renderer: Added 'width' parameter.John MacFarlane
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`.
2015-03-21Added commonmark renderer.John MacFarlane
This is still incomplete. (See TODOs in the source.)
2015-02-16Rename CMARK_OPT_SMARTPUNCT -> CMARK_OPT_SMART.John MacFarlane
2015-02-16Made 'options' an int rather than a long.John MacFarlane
For consistency with the API.
2015-02-16Move normalization step from main to cmark_parser_finish.John MacFarlane
2015-02-15Added options parameter to cmark_parse_document, cmark_parse_file.John MacFarlane
Also to some non-exported functions in blocks and inlines.
2015-02-15Moved normalization step from XML renderer to main.John MacFarlane
2015-02-14Added CMARK_OPT_SMARTPUNCT and --smart option.John MacFarlane
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.
2015-01-23Improve version informationNick Wellnhofer
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.
2015-01-07cmark: Add function & option to normalize text nodes.John MacFarlane
So, instead of <text>Hi</text> <text>&amp;</text> <text>lo</text> we get <text>Hi&amp;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.
2015-01-05Reformatted code consistently with astyle.John MacFarlane
2014-12-31Write to stdout in binary mode on WindowsNick Wellnhofer
This fixes the output of newlines.
2014-12-29Added options parameter to renderers.John MacFarlane
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.
2014-12-28Removed old 'ast' format, now that we have 'xml'.John MacFarlane
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.
2014-12-28Added xml writer, to dump the AST in XML.John MacFarlane
This is a work-in-progress. CommonMark.dtd gives the DTD for the generated XML. Closes #53.
2014-12-13Added cmark_render_man (man page writer).John MacFarlane
cmark: Replaced `--man` and `--ast` with generic `--to` option.
2014-12-02Fix EOF detectionNick Wellnhofer
Fixes issue with Ctrl-D having to be pressed twice when reading from terminal.
2014-11-30Renamed cmark_parser_push -> cmark_parser_feed.John MacFarlane
2014-11-29Push parser interfaceNick Wellnhofer
Replace cmark_parser_process_line with cmark_parser_push that takes arbitrary chunks of data. Also fixes #211.
2014-11-28Removed cmark_free_nodes from public API.John MacFarlane
Replace it with static S_free_nodes.