summaryrefslogtreecommitdiff
path: root/src/main.c
AgeCommit message (Collapse)Author
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.
2014-11-16Probe for stdbool.hNick Wellnhofer
Let cmake create a cmark_config.h file to deal with platforms missing stdbool.h.
2014-11-16Don't use variable-length arraysNick Wellnhofer
They're not supported by MSVC.
2014-11-16We don't need to include stdbool in the public header.John MacFarlane
2014-11-16cmark_render_html now just returns a regular C string.John MacFarlane
This way, we don't have to expose buffer.h; it is just used internally.
2014-11-15Expose lower-level parsing API.John MacFarlane
The new functions cmark_new_doc_parser, cmark_free_doc_parser, cmark_process_line, and cmark_finish allow you to feed lines one by one (possibly from several files) to the parser and call finish when you're done. This is now used in main for mulitple files.
2014-11-14Added some includes of buffer.hJohn MacFarlane
2014-11-13Moved the timing macros to get finer-grained information.John MacFarlane
2014-11-13Added bench.h and inserted timing macros in main.John MacFarlane
`make TIMER=1` to build with timings.
2014-11-13Rename cmark_free_nodes -> cmark_free_blocks.John MacFarlane
2014-11-11Don't include debug.h in any production code.John MacFarlane
It uses some GNU-specific things.
2014-10-24Renamed c program and library stmd -> cmark.John MacFarlane
Also renamed internal library functions accordingly.
2014-10-18Reindented c sources.John MacFarlane
2014-09-15Cleanup external APIsVicent Marti