diff --git a/readme.md b/readme.md index 6390fa7..b09445d 100644 --- a/readme.md +++ b/readme.md @@ -34,6 +34,12 @@ JParsedown parsedown = new JParsedown(); System.out.println(parsedown.text("Hello _Parsedown_!")); // prints:

Hello Parsedown!

``` +You can also parse inline markdown only: + +```java +System.out.println(parsedown.line("Hello _Parsedown_!")); // prints: Hello Parsedown! +``` + ### Security See [Parsedown Security](https://github.com/erusev/parsedown#security) page. @@ -42,10 +48,10 @@ See [Parsedown Security](https://github.com/erusev/parsedown#security) page. ### Header IDs Github automatically generates anchor IDs for each header in Markdown file to make it -easier to reference individual sections and create contents. JParsedown will attempt to generate +easier to reference individual sections and create the table of contents. JParsedown attempts to generate the same IDs, so the itra-page links in rendered HTML page still work like on Github. -For example, `## Header IDs` will create the following HTML: +For example, `## Header IDs` creates the following HTML: ```

Header IDs

diff --git a/src/com/xrbpowered/jparsedown/JParsedown.java b/src/com/xrbpowered/jparsedown/JParsedown.java index dd70988..c98121b 100644 --- a/src/com/xrbpowered/jparsedown/JParsedown.java +++ b/src/com/xrbpowered/jparsedown/JParsedown.java @@ -1254,6 +1254,10 @@ protected Inline[] getInlineTypes(char marker) { protected Pattern inlineMarkerList = Pattern.compile("[!\\*_&\\[:<`~\\\\]"); + public String line(String line) { + return elements(lineElements(line, null)); + } + protected LinkedList lineElements(String text, HashSet> nonNestables) { text = text.replaceAll("\\r\\n?", "\n"); LinkedList elements = new LinkedList<>(); @@ -1497,5 +1501,5 @@ public static int startSpan(String s, char c) { while(i