summaryrefslogtreecommitdiff
path: root/src/main.c
AgeCommit message (Collapse)Author
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.
2014-11-28Renamed identifiers in public API:John MacFarlane
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.
2014-11-25Replaced cmark_debug_print with cmark_render_ast.John MacFarlane
This returns a string.
2014-11-22Make parser accept a char*Nick Wellnhofer
2014-11-22Make render_html return a char*Nick Wellnhofer
2014-11-17Switch cmark_node_inl over to cmark_nodeNick Wellnhofer
2014-11-17Switch cmark_node_block over to cmark_nodeNick Wellnhofer
2014-11-16Free the string returned by html renderer in main program.John MacFarlane
2014-11-16Moved MAX_LINK_LABEL_LENGTH out of public header.John MacFarlane
Put it in ast.h.