# commonmark4j **Repository Path**: mirrors_hidekatsu-izuno/commonmark4j ## Basic Information - **Project Name**: commonmark4j - **Description**: commonmark4j is CommonMark transform library for Java - **Primary Language**: Unknown - **License**: BSD-2-Clause - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-08 - **Last Updated**: 2026-04-25 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README commonmark4j ============= Commonmark4j is a [CommonMark](http://commonmark.org/) transformer. The specification of this implementaion is defined by [CommonMark Spec](http://spec.commonmark.org/). The official reference implementation was written in C and JavaScript. Commonmark4j is ported from [commonmark.js](https://github.com/jgm/commonmark.js). Requirements -------------- - Java SE 8+ - Zero Dependencies Command Line -------------- Commonmark4j can run from command line. ``` Usage: java -jar commonmark4j-[version].jar [options] [source] [dest] Options: -help print this help message. -safe remove dangerous code. -smart use smart characters. -softbreak set softbreak characters. (default: \n) -sourcepos include source position information. -time print total time."); -format {html,xml} output as specified format. (default: html) ``` API Description -------------- You can find the classes of this library in net.arnx.commonmark4j package. The basic usage, use a CMarkTransformer class. ```java CMarkTransformer transformer = CMarkTransformer.newTransformer(); try (BufferedReader in = Files.newBufferedReader(Paths.get("...")); BufferedWriter out = Files.newBufferedWriter(Paths.get("..."))) { transformer.transform(in, out); } ``` If you want to use in same way as commonmark.js, you can use CMarkParser and CMarkRenderer. ```java CmarkNode node; CMarkParser parser = CMarkParser.newParser(); try (BufferedReader in = Files.newBufferedReader(Paths.get("...")) { node = parser.parse(in); } CMarkRenderer renderer = CMarkRenderer.newHtmlRenderer(); try (BufferedWriter out = Files.newBufferedWriter(Paths.get("..."))) { renderer.render(out); } ``` Maven Repository -------------- Commonmark4j is available in Maven central repository. ```xml net.arnx commonmark4j ``` License -------------- Commonmark4j is licensed by The 2 clause BSD License, see [LICENSE](https://github.com/hidekatsu-izuno/commonmark4j/blob/master/LICENSE).