@@ -0,0 +1,2921 @@
+package com.vladsch.flexmark.samples;%0A%0Aimport com.vladsch.flexmark.ast.Block;%0Aimport com.vladsch.flexmark.ast.Heading;%0Aimport com.vladsch.flexmark.ast.Node;%0Aimport com.vladsch.flexmark.ast.util.TextCollectingVisitor;%0Aimport com.vladsch.flexmark.html.HtmlRenderer;%0Aimport com.vladsch.flexmark.parser.Parser;%0Aimport com.vladsch.flexmark.profiles.pegdown.Extensions;%0Aimport com.vladsch.flexmark.profiles.pegdown.PegdownOptionsAdapter;%0Aimport com.vladsch.flexmark.util.options.DataHolder;%0Aimport com.vladsch.flexmark.util.options.MutableDataSet;%0A%0Apublic class TitleExtract %7B%0A    static final DataHolder OPTIONS = PegdownOptionsAdapter.flexmarkOptions(%0A            Extensions.ALL%0A    ).toMutable();%0A%0A    private static String findTitle(Node root) %7B%0A        if (root instanceof Heading) %7B%0A            Heading h = (Heading)root;%0A            if (h.getLevel() == 1 && h.hasChildren()) %7B%0A                TextCollectingVisitor collectingVisitor = new TextCollectingVisitor();%0A                return collectingVisitor.collectAndGetText(h);%0A            %7D%0A        %7D%0A%0A        if (root instanceof Block && root.hasChildren()) %7B%0A            Node child = root.getFirstChild();%0A            while (child != null) %7B%0A                String title = findTitle(child);%0A                if (title != null) %7B%0A                    return title;%0A                %7D%0A                child = child.getNext();%0A            %7D%0A        %7D%0A%0A        return null;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        // uncomment to set optional extensions%0A        //options.set(Parser.EXTENSIONS, Arrays.asList(TablesExtension.create(), StrikethroughExtension.create()));%0A%0A        // uncomment to convert soft-breaks to hard breaks%0A        //options.set(HtmlRenderer.SOFT_BREAK, %22%3Cbr /%3E%5Cn%22);%0A%0A        Parser parser = Parser.builder(OPTIONS).build();%0A        HtmlRenderer renderer = HtmlRenderer.builder(OPTIONS).build();%0A%0A        // You can re-use parser and renderer instances%0A        Node document = parser.parse(%22%5Cn%22 +%0A                %22# Plugin commit-message-length-validator%5Cn%22 +%0A                %22%5Cn%22 +%0A                %22Vendor%5Cn%22 +%0A                %22:  Gerrit Code Review%5Cn%22 +%0A                %22%5Cn%22 +%0A                %22Version%5Cn%22 +%0A                %22:  v2.15-rc2%5Cn%22 +%0A                %22%5Cn%22 +%0A                %22## About%5Cn%22 +%0A                %22%5Cn%22 +%0A                %22This plugin checks the length of a commit's commit message subject and body, and reports warnings and errors to the git client if the lentghts are exceeded.%5Cn%22 +%0A                %22%5Cn%22 +%0A                %22## Documentation%5Cn%22 +%0A                %22%5Cn%22 +%0A                %22* %5BCommit Message Length Configuration%5D(config.md)%5Cn%22 +%0A                %22%5Cn%22 +%0A                %22%22);%0A%0A        String title = findTitle(document);%0A        System.out.println(%22Title: %22 + title + %22%5Cn%22);%0A        String html = renderer.render(document);  // %22%3Cp%3EThis is %3Cem%3ESparta%3C/em%3E%3C/p%3E%5Cn%22%0A%0A        System.out.println(html);%0A    %7D%0A%7D%0A

update wiki and readme for new version number