diff --git a/.gitignore b/.gitignore index 2648869..4d7134d 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,5 @@ release.properties .idea *.iml +/pom.xml.versionsBackup +/markdown-page-generator-plugin.wiki/ diff --git a/LICENSE b/LICENSE index b575dff..3682f24 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,6 @@ The MIT License (MIT) +Copyright (c) 2017-2017 Vladimir Schneider Copyright (c) 2014 Marko Wallin Permission is hereby granted, free of charge, to any person obtaining a copy of @@ -17,4 +18,4 @@ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Readme.md b/Readme.md index 2dc14b5..b4044ca 100644 --- a/Readme.md +++ b/Readme.md @@ -1,8 +1,10 @@ # Markdown to HTML Page Generator Maven Plugin -Plugin creates static HTML pages with Maven and Markdown. Uses [pegdown](https://github.com/sirthias/pegdown) Markdown processor. The code is Open Source and under MIT license. +Plugin creates static HTML pages with Maven and Markdown. Uses [flexmark-java] Markdown +processor. The code is Open Source and under MIT license. -The plugin can be found in [Sonatype's OSS repository](https://oss.sonatype.org/content/groups/public/com/ruleoftech/markdown-page-generator-plugin/) and in [Central Repository](http://search.maven.org/). +This plugin is a fork of [walokra/markdown-page-generator-plugin] and replaces [pegdown] +markdown processor with [flexmark-java] processor. [![Build Status](https://travis-ci.org/walokra/markdown-page-generator-plugin.svg?branch=master)](https://travis-ci.org/walokra/markdown-page-generator-plugin) @@ -18,7 +20,8 @@ Plugin Information: ``` -You can configure the input and output directories, which files to copy and which pegdown options are used. You can also include custom header and footer and general title. +You can configure the input and output directories, which files to copy and which pegdown +options are used. You can also include custom header and footer and general title. Default configuration which can be overridden: @@ -88,23 +91,106 @@ Configuration options: ``` -* `copyDirectories`: Comma separead list of directories to copy to output directory, like: `css,js,images` +* `copyDirectories`: Comma separated list of directories to copy to output directory, like: + `css,js,images,folder*/images,**images' -* `defaultTitle`: If set the titleToken is replaced in every page. Otherwise the first h1 is used. +* `defaultTitle`: If set the titleToken is replaced in every page. Otherwise the first h1 is + used. -* `recursiveInput`: Process also inputDirectory's sub directories if option `true`. Default`false`. +* `recursiveInput`: Process also inputDirectory's sub directories if option `true`. Default + `false`. + +* `transformRelativeMarkdownLinks`: Transform relative url suffix from `.md` to `.html` if + option `true`. Default `false`. + +* `attributes`: defines a list of attributes by `Node` class to apply to HTML results. Each + `attribute` has the syntax: + `NodeClass|attributeName1=attributeValue1|attributeName2=attributeValue2` will add + `attributeName1` and `attributeName2` to element node `NodeClass` + + for table, block quote and ordered list item class customization: + + ```xml + + TableBlock|class=table table-striped table-bordered + BlockQuote|class=red + OrderedListItem|style="color:red;" + + ``` + + Core Nodes: + + * AutoLink + + * BlockQuote + + * BulletList + + * BulletListItem + + * Code + + * Emphasis + + * FencedCodeBlock + + * Heading + + * Image + + * ImageRef + + * IndentedCodeBlock + + * Link + + * LinkRef + + * MailLink + + * OrderedList + + * OrderedList + + * OrderedListItem + + * Strikethrough + + * StrongEmphasis -* `transformRelativeMarkdownLinks`: Transform relative url suffix from `.md` to `.html` if option `true`. Default `false`. + * TableBlock -* `pegdownExtensions`: Comma separated list of constants as specified in org.pegdown.Extensions. The default is TABLES. + * TableBody + + * TableCaption + + * TableCell + + * TableHead + + * TableRow + + * ThematicBreak + +* `pegdownExtensions`: Comma separated list of constants as specified in + `com.vladsch.flexmark.profiles.pegdown.Extensions`. The default is `TABLES`. + + :information_source: [flexmark-java] has many more extensions and configuration options than + [pegdown] in addition to extensions available in pegdown 1.6.0, the following extensions are + available: * `SMARTS`: Beautifies `...` `. . .`, `--` and `---` to `…`, `…`, `–` and `—` respectively. * `QUOTES`: Beautifies single quotes `'`, `"`, `<<` and `>>` to `‘` `’` `‛`, `“` `”` `‟`, `«` and `»` + * `SMARTYPANTS`: Convenience extension enabling both, `SMARTS` and `QUOTES`, at once. + * `ABBREVIATIONS`: Abbreviations in the way of [PHP Markdown Extra]. + * `ANCHORLINKS`: Generate anchor links for headers by taking the first range of alphanumerics + and spaces. + * `HARDWRAPS`: Alternative handling of newlines, see [Github-flavoured-Markdown] * `AUTOLINKS`: Plain, undelimited autolinks the way [Github-flavoured-Markdown] implements @@ -118,15 +204,123 @@ Configuration options: * `FENCED_CODE_BLOCKS`: Fenced Code Blocks in the way of [PHP Markdown Extra: fenced code] or [Github-flavoured-Markdown]. - * `WIKILINKS`: Support `[[Wiki-style links]]` with a customizable URL rendering logic. - * `SUPPRESS_HTML_BLOCKS`: Suppresses the output of HTML blocks. * `SUPPRESS_INLINE_HTML`: Suppresses the output of inline HTML elements. - - * `ANCHORLINKS`: Generate anchor links for headers by taking the first range of alphanumerics - and spaces. - + + * `WIKILINKS`: Support `[[Wiki-style links]]` with a customizable URL rendering logic. + + * `STRIKETHROUGH`: Support `~~strikethroughs~~` as supported in [Pandoc] and + [Github-flavoured-Markdown]. + + * `ATXHEADERSPACE`: Require a space between the `#` and the header title text, as per + [Github-flavoured-Markdown]. Frees up `#` without a space to be just plain text. + + * `FORCELISTITEMPARA`: Wrap a list item or definition term in `

` tags if it contains more + than a simple paragraph. + + * `RELAXEDHRULES`: allow horizontal rules without a blank line following them. + + * `TASKLISTITEMS`: parses bullet lists of the form `* [ ]`, `* [x]` and `* [X]` to create + [Github-flavoured-Markdown] task list items. + + * `EXTANCHORLINKS`: Generate anchor links for headers using complete contents of the header. + * Spaces and non-alphanumerics replaced by `-`, multiple dashes trimmed to one. + * Anchor link is added as first element inside the header with empty content: `

header

` + + * `EXTANCHORLINKS_WRAP`: used in conjunction with above to create an anchor that wraps header + content: `

header

` + + * `TOC`: used to enable table of contents extension `[TOC]` The TOC tag has the following + format: `[TOC style]`. `style` consists of space separated list of options: + * `levels=levelList` where level list is a comma separated list of levels or ranges. Default + is to include heading levels 2 and 3. Examples: + * `levels=4` include levels 2, 3 and 4 + * `levels=2-4` include levels 2, 3 and 4. same as `levels=4` + * `levels=2-4,5` include levels 2, 3, 4 and 5 + * `levels=1,3` include levels 1 and 3 + * `text` to only include the text of the heading + * `formatted` to include text and inline formatting + * `bullet` to use a bullet list for the TOC items + * `numbered` to use a numbered list for TOC items + * `hierarchy`: hierarchical list of headings + * `flat`: flat list of headings + * `reversed`: flat reversed list of headings + * `increasing`: flat, alphabetically increasing by heading text + * `decreasing`: flat, alphabetically decreasing by heading text + + * `MULTI_LINE_IMAGE_URLS`: enables parsing of image urls spanning more than one line the + format is strict `![alt text](urladdress?` must be the last non-blank segment on a line. The + terminating `)` or `"title")` must be the first non-indented segment on the line. Everything + in between is sucked up as part of the URL except for blank lines. + + * `RELAXED_STRONG_EMPHASIS_RULES`: allow Strong/Emphasis marks to start when not preceded by + alphanumeric for `_` and as long as not surrounded by spaces for `*` instead of only when + preceded by spaces. + + * `FOOTNOTES`: Support MultiMarkdown style footnotes: `[^n] for footnote reference` and `[^n]: + Footnote text` for footnotes. Where `n` is one or more digit, letter, `-`, `_` or `.`. + Footnotes will be put at the bottom of the page, sequentially numbered in order of + appearance of the footnote reference. Footnotes that are not referenced will NOT be included + in the HTML output. + + ```markdown + This paragraph has a footnote[^1] and another footnote[^two]. + + This one has more but out of sequence[^4] and[^eight]. + + [^two]: Footnote 2 with a bit more text + and another continuation line + + [^1]: Footnote 1 + + [^3]: Unused footnote, it will not be added to the end of the page. + + [^4]: Out of sequence footnote + + [^eight]: Have one that is used. + ``` + + will generate: + + ```html +

This paragraph has a footnote1 and another footnote2.

+

This one has more but out of sequence3 and4.

+
+
+
    +
  1. Footnote 1

  2. +
  3. Footnote 2 with a bit more text and another continuation line

  4. +
  5. Out of sequence footnote

  6. +
  7. Have one that is used.

  8. +
+
+ ``` + + to look like this: + +
+
+

This paragraph has a footnote1 and another footnote2.

+

This one has more but out of sequence3 and4.

+
+
+
    +
  1. Footnote 1

  2. +
  3. Footnote 2 with a bit more text and another continuation line

  4. +
  5. Out of sequence footnote

  6. +
  7. Have one that is used.

  8. +
+
+
+ + * `SUBSCRIPT`: subscript extension `~subscript~` + + * `SUPERSCRIPT`: superscript extension `^superscript^` + + * `INSERTED`: inserted or underlined extension `++inserted++` + * `inputEncoding`: Charset-Name used for reading the md-input, default: `${project.build.sourceEncoding}` or `Default-Charset` @@ -134,6 +328,7 @@ Configuration options: `${project.build.sourceEncoding}` or `Default-Charset` The output will be: + * `target/html/name_of_file.html` ## Configuration @@ -219,11 +414,21 @@ Input- and Output-Encoding can be specified by: - - ${basedir}/src/test/resources/encoding-project/src/main/resources/markdown - ${basedir}/target/test-harness/encoding-project/html - UTF-8 - ISO-8859-15 - + + ${basedir}/src/test/resources/encoding-project/src/main/resources/markdown + ${basedir}/target/test-harness/encoding-project/html + UTF-8 + ISO-8859-15 + ``` + +[flexmark-java]: https://github.com/vsch/flexmark-java +[Github-flavoured-Markdown]: http://github.github.com/github-flavored-markdown/ +[MultiMarkdown]: http://fletcherpenney.net/multimarkdown/ +[Pandoc]: http://pandoc.org/MANUAL.html#pandocs-markdown +[pegdown]: http://pegdown.org +[PHP Markdown Extra]: http://michelf.com/projects/php-markdown/extra/#abbr +[PHP Markdown Extra: definition list]: http://michelf.com/projects/php-markdown/extra/#def-list +[PHP Markdown Extra: fenced code]: http://michelf.com/projects/php-markdown/extra/#fenced-code-blocks +[PHP Markdown Extra: tables]: http://michelf.com/projects/php-markdown/extra/#table diff --git a/pom.xml b/pom.xml index b01eefa..f9003ae 100644 --- a/pom.xml +++ b/pom.xml @@ -1,13 +1,13 @@ 4.0.0 - com.ruleoftech + com.vladsch.flexmark markdown-page-generator-plugin 1.0.1-SNAPSHOT maven-plugin Markdown Page Generator Maven Plugin Markdown to HTML Page Generator Maven Plugin - http://ruleoftech.com/lab + https://github.com/vsch/markdown-page-generator-plugin @@ -33,6 +33,7 @@ UTF-8 + 0.7.9 @@ -60,9 +61,15 @@ - org.pegdown - pegdown - 1.6.0 + com.vladsch.flexmark + flexmark-profile-pegdown + 0.27.0 + + + + junit + junit + 4.12 @@ -103,46 +110,25 @@ - - - - org.apache.maven.plugins - maven-release-plugin - 2.5.3 - - false - release - deploy - - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.7 - true + org.codehaus.mojo + versions-maven-plugin + 2.3 - ossrh - https://oss.sonatype.org/ - true + false org.apache.maven.plugins - maven-plugin-plugin - 3.5 - - - true - + maven-gpg-plugin + 1.6 - mojo-descriptor + sign-artifacts + verify - descriptor + sign @@ -150,35 +136,64 @@ org.apache.maven.plugins maven-compiler-plugin - 3.6.0 + 3.5.1 - 1.6 - 1.6 + 7 + 7 - maven-release-plugin - 2.5.3 + maven-deploy-plugin + 2.8.1 + + true + + + + maven-source-plugin + 2.2.1 + + + package-sources + package + + jar + + + + + + maven-javadoc-plugin + 2.9.1 + + + package-javadoc + package + + jar + + + + + + org.jacoco + jacoco-maven-plugin + 0.7.9 + + + + prepare-agent + + + + report + prepare-package + + report + + + - - org.jacoco - jacoco-maven-plugin - 0.7.9 - - - - prepare-agent - - - - report - prepare-package - - report - - - - diff --git a/src/main/java/com/ruleoftech/markdown/page/generator/plugin/MDToHTMLExpLinkRender.java b/src/main/java/com/ruleoftech/markdown/page/generator/plugin/MDToHTMLExpLinkRender.java deleted file mode 100644 index 5a3110b..0000000 --- a/src/main/java/com/ruleoftech/markdown/page/generator/plugin/MDToHTMLExpLinkRender.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.ruleoftech.markdown.page.generator.plugin; - -import static org.pegdown.FastEncoder.encode; - -import org.parboiled.common.StringUtils; -import org.pegdown.LinkRenderer; -import org.pegdown.ast.ExpLinkNode; - -class MDToHTMLExpLinkRender extends LinkRenderer { - - private String inputFileExtension = "md"; - - MDToHTMLExpLinkRender(){ - super(); - } - - MDToHTMLExpLinkRender(String inputFileExtension){ - super(); - this.inputFileExtension = inputFileExtension; - } - - @Override - public Rendering render(ExpLinkNode node, String text) { - String url = node.url; - if (!url.startsWith("http://") && !url.startsWith("https://")) { - if(url.endsWith("."+inputFileExtension)){ - url = url.substring(0, url.length() - inputFileExtension.length()) + "html"; - }else if(url.contains("."+inputFileExtension+"#")){ - url = url.replace("."+inputFileExtension+"#", ".html#"); - } - } - Rendering rendering = new Rendering(url, text); - return StringUtils.isEmpty(node.title) ? rendering : rendering.withAttribute("title", encode(node.title)); - } -} diff --git a/src/main/java/com/vladsch/flexmark/page/generator/plugin/AttributesExtension.java b/src/main/java/com/vladsch/flexmark/page/generator/plugin/AttributesExtension.java new file mode 100644 index 0000000..f976c6f --- /dev/null +++ b/src/main/java/com/vladsch/flexmark/page/generator/plugin/AttributesExtension.java @@ -0,0 +1,27 @@ +package com.vladsch.flexmark.page.generator.plugin; + +import com.vladsch.flexmark.Extension; +import com.vladsch.flexmark.html.HtmlRenderer; +import com.vladsch.flexmark.util.html.Attributes; +import com.vladsch.flexmark.util.options.DataKey; +import com.vladsch.flexmark.util.options.MutableDataHolder; + +import java.util.Map; + +public class AttributesExtension implements HtmlRenderer.HtmlRendererExtension { + final static public DataKey> ATTRIBUTE_MAP = new DataKey<>("ATTRIBUTE_MAP", (Map) null); + + @Override + public void rendererOptions(final MutableDataHolder options) { + + } + + @Override + public void extend(HtmlRenderer.Builder rendererBuilder, String rendererType) { + rendererBuilder.attributeProviderFactory(new FlexmarkAttributeProvider.Factory()); + } + + public static Extension create() { + return new AttributesExtension(); + } +} diff --git a/src/main/java/com/vladsch/flexmark/page/generator/plugin/FlexmarkAttributeProvider.java b/src/main/java/com/vladsch/flexmark/page/generator/plugin/FlexmarkAttributeProvider.java new file mode 100644 index 0000000..d871b17 --- /dev/null +++ b/src/main/java/com/vladsch/flexmark/page/generator/plugin/FlexmarkAttributeProvider.java @@ -0,0 +1,38 @@ +package com.vladsch.flexmark.page.generator.plugin; + +import com.vladsch.flexmark.ast.Node; +import com.vladsch.flexmark.html.AttributeProvider; +import com.vladsch.flexmark.html.IndependentAttributeProviderFactory; +import com.vladsch.flexmark.html.renderer.AttributablePart; +import com.vladsch.flexmark.html.renderer.NodeRendererContext; +import com.vladsch.flexmark.util.html.Attributes; +import com.vladsch.flexmark.util.options.DataHolder; + +import java.util.Map; + +public class FlexmarkAttributeProvider implements AttributeProvider { + + final protected Map attributeMap; + + public FlexmarkAttributeProvider(NodeRendererContext context) { + DataHolder options = context.getOptions(); + attributeMap = options.get(AttributesExtension.ATTRIBUTE_MAP); + } + + @Override + public void setAttributes(Node node, AttributablePart part, Attributes attributes) { + if (attributeMap != null) { + Attributes attributes1 = attributeMap.get(node.getClass().getSimpleName()); + if (attributes1 != null) { + attributes.replaceValues(attributes1); + } + } + } + + public static class Factory extends IndependentAttributeProviderFactory { + @Override + public AttributeProvider create(NodeRendererContext context) { + return new FlexmarkAttributeProvider(context); + } + } +} diff --git a/src/main/java/com/vladsch/flexmark/page/generator/plugin/FlexmarkLinkResolver.java b/src/main/java/com/vladsch/flexmark/page/generator/plugin/FlexmarkLinkResolver.java new file mode 100644 index 0000000..5372080 --- /dev/null +++ b/src/main/java/com/vladsch/flexmark/page/generator/plugin/FlexmarkLinkResolver.java @@ -0,0 +1,55 @@ +package com.vladsch.flexmark.page.generator.plugin; + +import com.vladsch.flexmark.ast.Node; +import com.vladsch.flexmark.ext.wikilink.internal.WikiLinkLinkResolver; +import com.vladsch.flexmark.html.IndependentLinkResolverFactory; +import com.vladsch.flexmark.html.LinkResolver; +import com.vladsch.flexmark.html.LinkResolverFactory; +import com.vladsch.flexmark.html.renderer.*; +import com.vladsch.flexmark.util.options.DataHolder; + +import java.util.HashSet; +import java.util.Set; + +public class FlexmarkLinkResolver implements LinkResolver { + final String inputFileExtension; + + public FlexmarkLinkResolver(LinkResolverContext context) { + DataHolder options = context.getOptions(); + this.inputFileExtension = options.get(PageGeneratorExtension.INPUT_FILE_EXTENSION); + } + + @Override + public ResolvedLink resolveLink(Node node, LinkResolverContext context, ResolvedLink link) { + ResolvedLink result = link; + + if (link.getLinkType() == LinkType.LINK) { + String url = link.getUrl(); + if (!url.startsWith("http://") && !url.startsWith("https://")) { + if (url.endsWith("." + inputFileExtension)) { + url = url.substring(0, url.length() - inputFileExtension.length()) + "html"; + } else if (url.contains("." + inputFileExtension + "#")) { + url = url.replace("." + inputFileExtension + "#", ".html#"); + } + result = result.withStatus(LinkStatus.VALID).withUrl(url); + } + return result; + } + + return result; + } + + public static class Factory extends IndependentLinkResolverFactory { + @Override + public Set> getBeforeDependents() { + Set> set = new HashSet>(); + set.add(WikiLinkLinkResolver.Factory.class); + return set; + } + + @Override + public LinkResolver create(LinkResolverContext context) { + return new FlexmarkLinkResolver(context); + } + } +} diff --git a/src/main/java/com/ruleoftech/markdown/page/generator/plugin/MdPageGeneratorMojo.java b/src/main/java/com/vladsch/flexmark/page/generator/plugin/MdPageGeneratorMojo.java similarity index 70% rename from src/main/java/com/ruleoftech/markdown/page/generator/plugin/MdPageGeneratorMojo.java rename to src/main/java/com/vladsch/flexmark/page/generator/plugin/MdPageGeneratorMojo.java index 0dc7679..150d0f2 100644 --- a/src/main/java/com/ruleoftech/markdown/page/generator/plugin/MdPageGeneratorMojo.java +++ b/src/main/java/com/vladsch/flexmark/page/generator/plugin/MdPageGeneratorMojo.java @@ -1,25 +1,42 @@ -package com.ruleoftech.markdown.page.generator.plugin; - +package com.vladsch.flexmark.page.generator.plugin; + +import com.vladsch.flexmark.Extension; +import com.vladsch.flexmark.ast.Node; +import com.vladsch.flexmark.html.HtmlRenderer; +import com.vladsch.flexmark.parser.Parser; +import com.vladsch.flexmark.profiles.pegdown.Extensions; +import com.vladsch.flexmark.profiles.pegdown.PegdownOptionsAdapter; +import com.vladsch.flexmark.util.html.Attributes; +import com.vladsch.flexmark.util.options.MutableDataHolder; import org.apache.commons.io.FileUtils; import org.apache.maven.execution.MavenSession; import org.apache.maven.model.Resource; import org.apache.maven.model.interpolation.MavenBuildTimestamp; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugins.annotations.*; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; -import org.apache.maven.shared.filtering.*; -import org.codehaus.plexus.*; +import org.apache.maven.shared.filtering.MavenFilteringException; +import org.apache.maven.shared.filtering.MavenResourcesExecution; +import org.apache.maven.shared.filtering.MavenResourcesFiltering; +import org.codehaus.plexus.PlexusConstants; +import org.codehaus.plexus.PlexusContainer; import org.codehaus.plexus.component.repository.exception.ComponentLookupException; -import org.codehaus.plexus.context.*; +import org.codehaus.plexus.context.Context; +import org.codehaus.plexus.context.ContextException; import org.codehaus.plexus.util.StringUtils; -import org.pegdown.Extensions; -import org.pegdown.PegDownProcessor; -import java.io.*; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; import java.lang.reflect.Field; import java.nio.charset.Charset; +import java.nio.file.Path; +import java.nio.file.PathMatcher; import java.util.*; +import java.util.Map.Entry; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -74,6 +91,9 @@ public class MdPageGeneratorMojo extends AbstractMojo { @Parameter(property = "generate.timestampFormat", defaultValue = "yyyy-MM-dd\\'T\\'HH:mm:ss\\'Z\\'") private String timestampFormat; + @Parameter(property = "generate.attributes") + private String[] attributes; + @Component private MavenProject project; @@ -83,37 +103,44 @@ public class MdPageGeneratorMojo extends AbstractMojo { @Component protected MavenSession session; - // Possible options - // SMARTS: Beautifies apostrophes, ellipses ("..." and ". . .") and dashes ("--" and "---") - // QUOTES: Beautifies single quotes, double quotes and double angle quotes (« and ») - // ABBREVIATIONS: Abbreviations in the way of PHP Markdown Extra. - // HARDWRAPS: Alternative handling of newlines, see Github-flavoured-Markdown - // AUTOLINKS: Plain (undelimited) autolinks the way Github-flavoured-Markdown implements them. - // TABLES: Tables similar to MultiMarkdown (which is in turn like the PHP Markdown Extra tables, but with colspan support). - // DEFINITION LISTS: Definition lists in the way of PHP Markdown Extra. - // FENCED CODE BLOCKS: Fenced Code Blocks in the way of PHP Markdown Extra or Github-flavoured-Markdown. - // HTML BLOCK SUPPRESSION: Suppresses the output of HTML blocks. - // INLINE HTML SUPPRESSION: Suppresses the output of inline HTML elements. - // WIKILINKS Support [[Wiki-style links]] with a customizable URL rendering logic. @Parameter(property = "generate.pegdownExtensions", defaultValue = "TABLES") private String pegdownExtensions; private enum EPegdownExtensions { - NONE(0x00), - SMARTS(0x01), - QUOTES(0x02), - ABBREVIATIONS(0x04), - HARDWRAPS(0x08), - AUTOLINKS(0x10), - TABLES(0x20), - DEFINITIONS(0x40), - FENCED_CODE_BLOCKS(0x80), - WIKILINKS(0x100), - ALL(0x0000FFFF), - SUPPRESS_HTML_BLOCKS(0x00010000), - SUPPRESS_INLINE_HTML(0x00020000), - SUPPRESS_ALL_HTML(0x00030000), - ANCHORLINKS(0x400); + NONE(Extensions.NONE), + SMARTS(Extensions.SMARTS), + QUOTES(Extensions.QUOTES), + SMARTYPANTS(Extensions.SMARTYPANTS), + ABBREVIATIONS(Extensions.ABBREVIATIONS), + HARDWRAPS(Extensions.HARDWRAPS), + AUTOLINKS(Extensions.AUTOLINKS), + TABLES(Extensions.TABLES), + DEFINITIONS(Extensions.DEFINITIONS), + FENCED_CODE_BLOCKS(Extensions.FENCED_CODE_BLOCKS), + WIKILINKS(Extensions.WIKILINKS), + STRIKETHROUGH(Extensions.STRIKETHROUGH), + ANCHORLINKS(Extensions.ANCHORLINKS), + ALL(Extensions.ALL), + SUPPRESS_HTML_BLOCKS(Extensions.SUPPRESS_HTML_BLOCKS), + SUPPRESS_INLINE_HTML(Extensions.SUPPRESS_INLINE_HTML), + SUPPRESS_ALL_HTML(Extensions.SUPPRESS_ALL_HTML), + ATXHEADERSPACE(Extensions.ATXHEADERSPACE), + SUBSCRIPT(Extensions.SUBSCRIPT), + RELAXEDHRULES(Extensions.RELAXEDHRULES), + TASKLISTITEMS(Extensions.TASKLISTITEMS), + EXTANCHORLINKS(Extensions.EXTANCHORLINKS), + EXTANCHORLINKS_WRAP(Extensions.EXTANCHORLINKS_WRAP), + FOOTNOTES(Extensions.FOOTNOTES), + TOC(Extensions.TOC), + MULTI_LINE_IMAGE_URLS(Extensions.MULTI_LINE_IMAGE_URLS), + SUPERSCRIPT(Extensions.SUPERSCRIPT), + FORCELISTITEMPARA(Extensions.FORCELISTITEMPARA), + INSERTED(Extensions.INSERTED), + ALL_OPTIONALS(Extensions.ALL_OPTIONALS), + ALL_WITH_OPTIONALS(Extensions.ALL_WITH_OPTIONALS), + GITHUB_DOCUMENT_COMPATIBLE(Extensions.GITHUB_DOCUMENT_COMPATIBLE), + GITHUB_WIKI_COMPATIBLE(Extensions.GITHUB_WIKI_COMPATIBLE), + GITHUB_COMMENT_COMPATIBLE(Extensions.GITHUB_COMMENT_COMPATIBLE); private final int value; @@ -124,7 +151,6 @@ private enum EPegdownExtensions { public int getValue() { return value; } - } /** @@ -136,8 +162,34 @@ public int getValue() { private List markdownDTOs = new ArrayList(); @Parameter(property = "generate.filteredOutputDirectory", defaultValue = "${project.build.directory}/filtered-md/") - private File filteredOutputDiretory; + private File filteredOutputDirectory; + + public String getInputDirectory() { + return inputDirectory; + } + + public void setInputDirectory(String inputDirectory) { + this.inputDirectory = inputDirectory; + } + + public String getOutputDirectory() { + return outputDirectory; + } + public void setOutputDirectory(String outputDirectory) { + this.outputDirectory = outputDirectory; + } + + public String getCopyDirectories() { + return copyDirectories; + } + + public void setCopyDirectories(String copyDirectories) { + this.copyDirectories = copyDirectories; + } + + + /** * Execute the maven plugin. * @@ -147,8 +199,8 @@ public int getValue() { public void execute() throws MojoExecutionException { // First, if filtering is enabled, perform that using the Maven magic if (applyFiltering) { - peformMavenPropertyFiltering(new File(inputDirectory), filteredOutputDiretory, getInputEncoding()); - inputDirectory = filteredOutputDiretory.getAbsolutePath(); + performMavenPropertyFiltering(new File(inputDirectory), filteredOutputDirectory, getInputEncoding()); + inputDirectory = filteredOutputDirectory.getAbsolutePath(); } getLog().info("Pre-processing markdown files from input directory: " + inputDirectory); @@ -157,18 +209,102 @@ public void execute() throws MojoExecutionException { if (!markdownDTOs.isEmpty()) { getLog().info("Process Pegdown extension options"); int options = getPegdownExtensions(pegdownExtensions); + final Map attributesMap = processAttributes(attributes); getLog().info("Parse Markdown to HTML"); - processMarkdown(markdownDTOs, options); + processMarkdown(markdownDTOs, options, attributesMap); } // FIXME: This will possibly overwrite any filtering updates made in the maven property filtering step above if (StringUtils.isNotEmpty(copyDirectories)) { getLog().info("Copy files from directories"); for (String dir : copyDirectories.split(",")) { - copyFiles(inputDirectory + File.separator + dir, outputDirectory + File.separator + dir); + for ( Entry copyAction : getFoldersToCopy(inputDirectory, outputDirectory, dir).entrySet()){ + copyFiles(copyAction.getKey(), copyAction.getValue()); + } + } + } + } + + private Map getFoldersToCopy(String inputDirectory, String outputDirectory, String dir) throws MojoExecutionException { + try { + Map retValue = new HashMap<>(); + + Collection stream = getPathMatchingGlob(inputDirectory, dir); + for (Path path : stream) { + final Path inFolderPath = new File(inputDirectory).toPath(); + Path relativePath = inFolderPath.relativize(path); + + Path resolvedOutPath = new File(outputDirectory).toPath().resolve(relativePath); + Path resolvedInPath = new File(inputDirectory).toPath().resolve(relativePath); + + retValue.put(resolvedInPath.toFile().getAbsolutePath(), resolvedOutPath.toFile().getAbsolutePath()); + } + + return retValue; + } catch (IOException ex) { + throw new MojoExecutionException("failed to determine the folders to copy", ex); + } + + } + + private Collection getPathMatchingGlob(String inputDirectory1, String dir) throws IOException { + List retValue = new LinkedList<>(); + + Iterator files = FileUtils.iterateFiles(new File(inputDirectory1), null, true); + while (files.hasNext()) { + File file = files.next(); + file = file.getParentFile(); + + if (file.isDirectory()) { + + String expandedGlob = new File(inputDirectory1).getAbsolutePath() + File.separator + dir; + PathMatcher pathMatcher = file.toPath().getFileSystem().getPathMatcher("glob:" + expandedGlob); + + if (pathMatcher.matches(file.toPath())) { + if (!retValue.contains(file.toPath())) { + retValue.add(file.toPath()); + } + } } } + + return retValue; + } + + + + /** + * Parse attributes of the form NodeName:attributeName=attribute value:attributeName=attribute value... + * + * @param attributeList list of attributes + * @return map of Node class to attributable part and attributes + */ + private Map processAttributes(String[] attributeList) { + HashMap nodeAttributeMap = new HashMap<>(); + + for (String attribute : attributeList) { + String[] nodeAttributes = attribute.split("\\|"); + Attributes attributes = new Attributes(); + for (int i = 1; i < nodeAttributes.length; i++) { + String[] attributeNameValue = nodeAttributes[i].split("=", 2); + if (attributeNameValue.length > 1) { + String value = attributeNameValue[1]; + if (!value.isEmpty()) { + if (value.charAt(0) == '"' && value.charAt(value.length() - 1) == '"') { + value = value.substring(1, value.length() - 1); + } else if (value.charAt(0) == '\'' && value.charAt(value.length() - 1) == '\'') { + value = value.substring(1, value.length() - 1); + } + } + attributes.addValue(attributeNameValue[0], value); + } else { + attributes.addValue(attributeNameValue[0], attributeNameValue[0]); + } + } + nodeAttributeMap.put(nodeAttributes[0], attributes); + } + return nodeAttributeMap; } private int getPegdownExtensions(String extensions) { @@ -178,6 +314,7 @@ private int getPegdownExtensions(String extensions) { if (!ext.isEmpty()) { Field f = Extensions.class.getField(ext); options |= f.getInt(null); + getLog().info("Pegdown extension " + ext); } } catch (NoSuchFieldException e) { throw new IllegalArgumentException("No such extension: " + ext); @@ -186,7 +323,7 @@ private int getPegdownExtensions(String extensions) { } } - // getLog().info("Pegdown extension options = " + options); + getLog().info("Pegdown extension options = " + options); return options; } @@ -198,6 +335,7 @@ private int getPegdownExtensions(String extensions) { * Is there files to read * @throws MojoExecutionException Unable to load file */ + @SuppressWarnings("UnusedReturnValue") private boolean preprocessMarkdownFiles(File inputDirectory) throws MojoExecutionException { getLog().debug("Read files from: " + inputDirectory); @@ -209,7 +347,7 @@ private boolean preprocessMarkdownFiles(File inputDirectory) throws MojoExecutio int baseDepth = StringUtils.countMatches(inputDirectory.getAbsolutePath(), File.separator); // Reading just the markdown dir and sub dirs if recursive option set - List markdownFiles = getFilesAsArray(FileUtils.iterateFiles(inputDirectory, new String[]{inputFileExtension}, recursiveInput)); + List markdownFiles = getFilesAsArray(FileUtils.iterateFiles(inputDirectory, new String[] { inputFileExtension }, recursiveInput)); for (File file : markdownFiles) { getLog().debug("File getName() " + file.getName()); @@ -241,7 +379,10 @@ private boolean preprocessMarkdownFiles(File inputDirectory) throws MojoExecutio dto.htmlFile = new File( recursiveInput - ? outputDirectory + File.separator + file.getParentFile().getPath().substring(inputDirectory.getPath().length()) + File.separator + file.getName().replaceAll("." + inputFileExtension, ".html") + ? outputDirectory + File.separator + file.getParentFile().getPath().substring(inputDirectory.getPath().length()) + File.separator + file.getName().replaceAll( + "." + inputFileExtension, + ".html" + ) : outputDirectory + File.separator + file.getName().replaceAll("." + inputFileExtension, ".html") ); @@ -259,10 +400,10 @@ private boolean preprocessMarkdownFiles(File inputDirectory) throws MojoExecutio /** * Replace variables with given pattern. * - * @param template String to replace + * @param template String to replace * @param patternString regexp pattern - * @param variables variables to find - * @return + * @param variables variables to find + * @return result */ private String substituteVariables(String template, String patternString, Map variables) { Pattern pattern = Pattern.compile(patternString); @@ -285,12 +426,33 @@ private String substituteVariables(String template, String patternString, Map markdownDTOs, int options) throws MojoExecutionException { + private void processMarkdown(List markdownDTOs, int options, final Map attributesMap) throws MojoExecutionException { getLog().debug("Process Markdown"); getLog().debug("inputEncoding: '" + getInputEncoding() + "', outputEncoding: '" + getOutputEncoding() + "'"); - getLog().debug("parsingTimeout: " + getParsingTimeoutInMillis() + " ms"); + //getLog().debug("parsingTimeout: " + getParsingTimeoutInMillis() + " ms"); getLog().debug("applyFiltering: " + applyFiltering); + MutableDataHolder flexmarkOptions = PegdownOptionsAdapter.flexmarkOptions(options).toMutable(); + ArrayList extensions = new ArrayList(); + for (Extension extension : flexmarkOptions.get(Parser.EXTENSIONS)) { + extensions.add(extension); + } + + if (transformRelativeMarkdownLinks) { + flexmarkOptions.set(PageGeneratorExtension.INPUT_FILE_EXTENSION, inputFileExtension); + extensions.add(PageGeneratorExtension.create()); + } + + if (!attributesMap.isEmpty()) { + flexmarkOptions.set(AttributesExtension.ATTRIBUTE_MAP, attributesMap); + extensions.add(AttributesExtension.create()); + } + + flexmarkOptions.set(Parser.EXTENSIONS, extensions); + + Parser parser = Parser.builder(flexmarkOptions).build(); + HtmlRenderer renderer = HtmlRenderer.builder(flexmarkOptions).build(); + for (MarkdownDTO dto : markdownDTOs) { getLog().debug("dto: " + dto); @@ -326,19 +488,13 @@ private void processMarkdown(List markdownDTOs, int options) throws markdown = replaceVariables(markdown, dto.substitutes); // getLog().debug(markdown); - PegDownProcessor pegDownProcessor = new PegDownProcessor(options, getParsingTimeoutInMillis()); String markdownAsHtml; - if (transformRelativeMarkdownLinks) { - markdownAsHtml = pegDownProcessor.markdownToHtml(markdown, new MDToHTMLExpLinkRender(inputFileExtension)); - } else { - markdownAsHtml = pegDownProcessor.markdownToHtml(markdown); - } - StringBuilder data = new StringBuilder(); - data.append(headerHtml); - data.append(markdownAsHtml); - data.append(footerHtml); - FileUtils.writeStringToFile(dto.htmlFile, data.toString(), getOutputEncoding()); + Node document = parser.parse(markdown); + markdownAsHtml = renderer.render(document); + + String data = headerHtml + markdownAsHtml + footerHtml; + FileUtils.writeStringToFile(dto.htmlFile, data, getOutputEncoding()); } catch (MojoExecutionException e) { throw e; } catch (IOException e) { @@ -368,13 +524,13 @@ public String getInputFileExtension() { return inputFileExtension; } - private long getParsingTimeoutInMillis() { - if (parsingTimeoutInMillis != null) { - return parsingTimeoutInMillis; - } - - return PegDownProcessor.DEFAULT_MAX_PARSING_TIME; - } + //private long getParsingTimeoutInMillis() { + // if (parsingTimeoutInMillis != null) { + // return parsingTimeoutInMillis; + // } + // + // return PegDownProcessor.DEFAULT_MAX_PARSING_TIME; + //} /** * Get the first h1 for the title. @@ -429,10 +585,10 @@ private String addTitleToHtmlFile(String html, String title) { } /** - * Replace variables to the html file. + * Replace variables in the html file. * - * @param initialContent - * @param variables + * @param initialContent html + * @param variables variable map * @return the updated html */ private String replaceVariables(String initialContent, Map variables) { @@ -453,7 +609,6 @@ private static boolean isVariableLine(String line) { return line.matches("^\\{.*=.*\\}$"); } - /** * Update relative include paths corresponding to the markdown file's location in the folder structure. * @@ -521,14 +676,13 @@ private List getFilesAsArray(Iterator iterator) { * Store information about markdown file. */ private class MarkdownDTO { - public String title; - public Map substitutes = new HashMap(); - public File htmlFile; - public File markdownFile; - public int folderDepth = 0; + String title; + Map substitutes = new HashMap(); + File htmlFile; + File markdownFile; + int folderDepth = 0; } - /** * MAVEN RESOURCE FILTERING: Heavily borrowed from Apache Maven ResourcesMojo (https://maven.apache.org/plugins/maven-resources-plugin) **/ @@ -577,7 +731,7 @@ public void contextualize(Context context) throws ContextException { plexusContainer = (PlexusContainer) context.get(PlexusConstants.PLEXUS_KEY); } - private void peformMavenPropertyFiltering(final File inputDirectory, final File outputDirectory, final String inputEncoding) throws MojoExecutionException { + private void performMavenPropertyFiltering(final File inputDirectory, final File outputDirectory, final String inputEncoding) throws MojoExecutionException { try { List combinedFilters = getCombinedFiltersList(); @@ -587,7 +741,15 @@ private void peformMavenPropertyFiltering(final File inputDirectory, final File resource.setDirectory(inputDirectory.getAbsolutePath()); resources.add(resource); - MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution(resources, outputDirectory, project, this.inputEncoding, combinedFilters, Collections.emptyList(), session); + MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution( + resources, + outputDirectory, + project, + this.inputEncoding, + combinedFilters, + Collections.emptyList(), + session + ); // mavenResourcesExecution.setEscapeWindowsPaths(escapeWindowsPaths); @@ -619,7 +781,7 @@ private void peformMavenPropertyFiltering(final File inputDirectory, final File mavenResourcesExecution.getOutputDirectory(); } catch (MavenFilteringException e) { - throw new MojoExecutionException("Failure while processing/fitering markdown sources: " + e.getMessage(), e); + throw new MojoExecutionException("Failure while processing/filtering markdown sources: " + e.getMessage(), e); } } @@ -706,5 +868,4 @@ protected List getCombinedFiltersList() { return result; } } - } diff --git a/src/main/java/com/vladsch/flexmark/page/generator/plugin/PageGeneratorExtension.java b/src/main/java/com/vladsch/flexmark/page/generator/plugin/PageGeneratorExtension.java new file mode 100644 index 0000000..af287dd --- /dev/null +++ b/src/main/java/com/vladsch/flexmark/page/generator/plugin/PageGeneratorExtension.java @@ -0,0 +1,24 @@ +package com.vladsch.flexmark.page.generator.plugin; + +import com.vladsch.flexmark.Extension; +import com.vladsch.flexmark.html.HtmlRenderer; +import com.vladsch.flexmark.util.options.DataKey; +import com.vladsch.flexmark.util.options.MutableDataHolder; + +public class PageGeneratorExtension implements HtmlRenderer.HtmlRendererExtension { + final static public DataKey INPUT_FILE_EXTENSION = new DataKey("INPUT_FILE_EXTENSION", "md"); + + @Override + public void rendererOptions(final MutableDataHolder options) { + + } + + @Override + public void extend(HtmlRenderer.Builder rendererBuilder, String rendererType) { + rendererBuilder.linkResolverFactory(new FlexmarkLinkResolver.Factory()); + } + + public static Extension create() { + return new PageGeneratorExtension(); + } +} diff --git a/src/test/java/com/ruleoftech/markdown/page/generator/plugin/MdPageGeneratorMojoTest.java b/src/test/java/com/ruleoftech/markdown/page/generator/plugin/MdPageGeneratorMojoTest.java deleted file mode 100644 index 14f89f5..0000000 --- a/src/test/java/com/ruleoftech/markdown/page/generator/plugin/MdPageGeneratorMojoTest.java +++ /dev/null @@ -1,180 +0,0 @@ -package com.ruleoftech.markdown.page.generator.plugin; - -import org.apache.commons.io.FileUtils; -import org.pegdown.ParsingTimeoutException; - -import java.io.File; - -/** - * Unit test for {@link MdPageGeneratorMojo} - */ -public class MdPageGeneratorMojoTest extends BetterAbstractMojoTestCase { - public void testEncoding() throws Exception { - final String expectedGeneratedHTMLFile = "/target/test-harness/encoding-project/target/html/README.html"; - - // ensure this java-File will not be affected by - // encoding issues therefore escape umlaut-characters - final String UMLAUTS = - "Some Umlauts: " + - "\u00f6" + // ö - "\u00e4" + // ä - "\u00fc" + // ü - " " + - "\u00d6" + // Ö - "\u00c4" + // Ä - "\u00dc" + // Ü - " " + // - "\u00df"; // ß - final String EURO = - "Euro: " + - "\u20ac"; // € - - File pom = getTestFile("src/test/resources/encoding-project/pom.xml"); - assertTrue(pom.exists()); - - MdPageGeneratorMojo mdPageGeneratorMojo = (MdPageGeneratorMojo) lookupConfiguredMojo(pom, "generate"); - assertNotNull(mdPageGeneratorMojo); - - mdPageGeneratorMojo.execute(); - - File generatedMarkdown = new File(getBasedir(), expectedGeneratedHTMLFile); - assertTrue("Expected HTML file does not exist: " + generatedMarkdown, generatedMarkdown.exists()); - - String markDown = FileUtils.readFileToString(generatedMarkdown, "ISO-8859-15"); - assertNotNull(markDown); - assertTrue(markDown.contains(UMLAUTS)); - assertTrue(markDown.contains(EURO)); - - } - - public void testBasicProject() - throws Exception { - final String expectedGeneratedHTMLFile = "/target/test-harness/basic-project/target/html/README.html"; - - File pom = getTestFile("src/test/resources/basic-project/pom.xml"); - assertTrue(pom.exists()); - - MdPageGeneratorMojo mdPageGeneratorMojo = (MdPageGeneratorMojo) lookupConfiguredMojo(pom, "generate"); - assertNotNull(mdPageGeneratorMojo); - - mdPageGeneratorMojo.execute(); - - File generatedMarkdown = new File(getBasedir(), expectedGeneratedHTMLFile); - assertTrue("Expected HTML file does not exist: " + generatedMarkdown, generatedMarkdown.exists()); - } - - public void testBasicProjectWithRenamedInOutDirectories() throws Exception { - final String expectedGeneratedHTMLFile = "/target/test-harness/basic-project-custom-inout-directories/target/html-renamed/README.html"; - final String notExpectedGeneratedHTMLFile = "/target/test-harness/basic-project-custom-inout-directories/target/html/README.html"; - - File pom = getTestFile("src/test/resources/basic-project-custom-inout-directories/pom.xml"); - assertTrue(pom.exists()); - - MdPageGeneratorMojo mdPageGeneratorMojo = (MdPageGeneratorMojo) lookupConfiguredMojo(pom, "generate"); - assertNotNull(mdPageGeneratorMojo); - - mdPageGeneratorMojo.execute(); - - File generatedMarkdown = new File(getBasedir(), expectedGeneratedHTMLFile); - assertTrue("Expected HTML file does not exist: " + generatedMarkdown, generatedMarkdown.exists()); - - File notGeneratedMarkdown = new File(getBasedir(), notExpectedGeneratedHTMLFile); - assertFalse("Unexpected HTML file exist: " + notGeneratedMarkdown, notGeneratedMarkdown.exists()); - - } - - public void testBasicProjectExtension() - throws Exception { - final String expectedGeneratedHTMLFile = "/target/test-harness/basic-project-extension/target/html/README.html"; - - File pom = getTestFile("src/test/resources/basic-project-extension/pom.xml"); - assertTrue(pom.exists()); - - MdPageGeneratorMojo mdPageGeneratorMojo = (MdPageGeneratorMojo) lookupConfiguredMojo(pom, "generate"); - assertNotNull(mdPageGeneratorMojo); - assertEquals("markdown", mdPageGeneratorMojo.getInputFileExtension()); - - mdPageGeneratorMojo.execute(); - - File generatedMarkdown = new File(getBasedir(), expectedGeneratedHTMLFile); - assertTrue("Expected HTML file does not exist: " + generatedMarkdown, generatedMarkdown.exists()); - - String markDown = FileUtils.readFileToString(generatedMarkdown, "ISO-8859-15"); - assertNotNull(markDown); - assertTrue(markDown.contains("README.html")); - } - - public void testRecursiveProject() - throws Exception { - final String expectedGeneratedHTMLFileBaseDir = "/target/test-harness/recursive-project/target/html/"; - - File pom = getTestFile("src/test/resources/recursive-project/pom.xml"); - assertTrue(pom.exists()); - - MdPageGeneratorMojo mdPageGeneratorMojo = (MdPageGeneratorMojo) lookupConfiguredMojo(pom, "generate"); - assertNotNull(mdPageGeneratorMojo); - - mdPageGeneratorMojo.execute(); - - File index = new File(getBasedir(), expectedGeneratedHTMLFileBaseDir + "index.html"); - assertTrue(index.exists()); - - File page1 = new File(getBasedir(), expectedGeneratedHTMLFileBaseDir + "pages/page-1.html"); - assertTrue(page1.exists()); - - File page2 = new File(getBasedir(), expectedGeneratedHTMLFileBaseDir + "pages/page-2.html"); - assertTrue(page2.exists()); - - File page11 = new File(getBasedir(), expectedGeneratedHTMLFileBaseDir + "pages/embedded/page-1-1.html"); - assertTrue(page11.exists()); - } - - public void testParsingTimeout() - throws Exception { - File pom = getTestFile("src/test/resources/timeout-project/pom.xml"); - assertTrue(pom.exists()); - - MdPageGeneratorMojo mdPageGeneratorMojo = (MdPageGeneratorMojo) lookupConfiguredMojo(pom, "generate"); - - assertNotNull(mdPageGeneratorMojo); - - try { - mdPageGeneratorMojo.execute(); - fail(); - } catch (Exception ex) { - assertEquals(ParsingTimeoutException.class, ex.getCause().getClass()); - } - } - - public void testSubstituteProject() throws Exception { - final String expectedGeneratedHTMLFile = "/target/test-harness/substitute-project/target/html/README.html"; - - File pom = getTestFile("src/test/resources/substitute-project/pom.xml"); - assertTrue(pom.exists()); - - MdPageGeneratorMojo mdPageGeneratorMojo = (MdPageGeneratorMojo) lookupConfiguredMojo(pom, "generate"); - assertNotNull(mdPageGeneratorMojo); - - mdPageGeneratorMojo.execute(); - - File generatedMarkdown = new File(getBasedir(), expectedGeneratedHTMLFile); - assertTrue("Expected HTML file does not exist: " + generatedMarkdown, generatedMarkdown.exists()); - - String html = FileUtils.readFileToString(generatedMarkdown); - - assertFalse("Shouldn't contain the var declaration", html.contains("headerSubstitution")); - assertFalse("Shouldn't contain the var declaration", html.contains("footerSubstitution")); - - assertFalse("Shouldn't contain the original var", html.contains("${headerSubstitution}")); - assertFalse("Shouldn't contain the original var", html.contains("${footerSubstitution}")); - - assertTrue("Should contain the replaced var", html.contains("The new header")); - assertTrue("Should contain the replaced var", html.contains("The new footer")); - - assertTrue("Should contain the replaced Maven variable 'substitute-project'", html.contains("substitute-project")); - - assertTrue("Should contain the original var 'beanId'", html.contains("${beanId}")); - assertTrue("Should contain the original var 'cacheManager'", html.contains("${cacheManager}")); - } - -} diff --git a/src/test/java/com/ruleoftech/markdown/page/generator/plugin/BetterAbstractMojoTestCase.java b/src/test/java/com/vladsch/flexmark/page/generator/plugin/BetterAbstractMojoTestCase.java similarity index 98% rename from src/test/java/com/ruleoftech/markdown/page/generator/plugin/BetterAbstractMojoTestCase.java rename to src/test/java/com/vladsch/flexmark/page/generator/plugin/BetterAbstractMojoTestCase.java index 11ffaaa..86c6254 100644 --- a/src/test/java/com/ruleoftech/markdown/page/generator/plugin/BetterAbstractMojoTestCase.java +++ b/src/test/java/com/vladsch/flexmark/page/generator/plugin/BetterAbstractMojoTestCase.java @@ -1,4 +1,4 @@ -package com.ruleoftech.markdown.page.generator.plugin; +package com.vladsch.flexmark.page.generator.plugin; import java.io.File; import java.util.Arrays; diff --git a/src/test/java/com/vladsch/flexmark/page/generator/plugin/MdPageGeneratorMojoTest.java b/src/test/java/com/vladsch/flexmark/page/generator/plugin/MdPageGeneratorMojoTest.java new file mode 100644 index 0000000..2950096 --- /dev/null +++ b/src/test/java/com/vladsch/flexmark/page/generator/plugin/MdPageGeneratorMojoTest.java @@ -0,0 +1,453 @@ +package com.vladsch.flexmark.page.generator.plugin; + +import com.google.common.io.Files; +import org.apache.commons.io.FileUtils; +import org.apache.maven.plugin.MojoExecutionException; + +import java.io.File; +import java.io.IOException; +import java.util.Iterator; +import org.junit.Assert; +import org.junit.Test; + +/** + * Unit test for {@link MdPageGeneratorMojo} + */ +public class MdPageGeneratorMojoTest extends BetterAbstractMojoTestCase { + + public void testEncoding() throws Exception { + final String expectedGeneratedHTMLFile = "/target/test-harness/encoding-project/target/html/README.html"; + + // ensure this java-File will not be affected by + // encoding issues therefore escape umlaut-characters + final String UMLAUTS + = "Some Umlauts: " + + "\u00f6" + // ö + "\u00e4" + // ä + "\u00fc" + // ü + " " + + "\u00d6" + // Ö + "\u00c4" + // Ä + "\u00dc" + // Ü + " " + // + "\u00df"; // ß + final String EURO + = "Euro: " + + "\u20ac"; // € + + File pom = getTestFile("src/test/resources/encoding-project/pom.xml"); + assertTrue(pom.exists()); + + MdPageGeneratorMojo mdPageGeneratorMojo = (MdPageGeneratorMojo) lookupConfiguredMojo(pom, "generate"); + assertNotNull(mdPageGeneratorMojo); + + mdPageGeneratorMojo.execute(); + + File generatedMarkdown = new File(getBasedir(), expectedGeneratedHTMLFile); + assertTrue("Expected HTML file does not exist: " + generatedMarkdown, generatedMarkdown.exists()); + + String markDown = FileUtils.readFileToString(generatedMarkdown, "ISO-8859-15"); + assertNotNull(markDown); + assertTrue(markDown.contains(UMLAUTS)); + assertTrue(markDown.contains(EURO)); + + } + + public void testBasicProject() + throws Exception { + final String expectedGeneratedHTMLFile = "/target/test-harness/basic-project/target/html/README.html"; + + File pom = getTestFile("src/test/resources/basic-project/pom.xml"); + assertTrue(pom.exists()); + + MdPageGeneratorMojo mdPageGeneratorMojo = (MdPageGeneratorMojo) lookupConfiguredMojo(pom, "generate"); + assertNotNull(mdPageGeneratorMojo); + + mdPageGeneratorMojo.execute(); + + File generatedMarkdown = new File(getBasedir(), expectedGeneratedHTMLFile); + assertTrue("Expected HTML file does not exist: " + generatedMarkdown, generatedMarkdown.exists()); + } + + public void testBasicProjectWithRenamedInOutDirectories() throws Exception { + final String expectedGeneratedHTMLFile = "/target/test-harness/basic-project-custom-inout-directories/target/html-renamed/README.html"; + final String notExpectedGeneratedHTMLFile = "/target/test-harness/basic-project-custom-inout-directories/target/html/README.html"; + + File pom = getTestFile("src/test/resources/basic-project-custom-inout-directories/pom.xml"); + assertTrue(pom.exists()); + + MdPageGeneratorMojo mdPageGeneratorMojo = (MdPageGeneratorMojo) lookupConfiguredMojo(pom, "generate"); + assertNotNull(mdPageGeneratorMojo); + + mdPageGeneratorMojo.execute(); + + File generatedMarkdown = new File(getBasedir(), expectedGeneratedHTMLFile); + assertTrue("Expected HTML file does not exist: " + generatedMarkdown, generatedMarkdown.exists()); + + File notGeneratedMarkdown = new File(getBasedir(), notExpectedGeneratedHTMLFile); + assertFalse("Unexpected HTML file exist: " + notGeneratedMarkdown, notGeneratedMarkdown.exists()); + + } + + public void testBasicProjectExtension() + throws Exception { + final String expectedGeneratedHTMLFile = "/target/test-harness/basic-project-extension/target/html/README.html"; + + File pom = getTestFile("src/test/resources/basic-project-extension/pom.xml"); + assertTrue(pom.exists()); + + MdPageGeneratorMojo mdPageGeneratorMojo = (MdPageGeneratorMojo) lookupConfiguredMojo(pom, "generate"); + assertNotNull(mdPageGeneratorMojo); + assertEquals("markdown", mdPageGeneratorMojo.getInputFileExtension()); + + mdPageGeneratorMojo.execute(); + + File generatedMarkdown = new File(getBasedir(), expectedGeneratedHTMLFile); + assertTrue("Expected HTML file does not exist: " + generatedMarkdown, generatedMarkdown.exists()); + + String markDown = FileUtils.readFileToString(generatedMarkdown, "ISO-8859-15"); + assertNotNull(markDown); + assertTrue(markDown.contains("README.html")); + } + + public void testCustomAttributes() + throws Exception { + final String expectedGeneratedHTMLFile = "/target/test-harness/custom-attributes/target/html/README.html"; + + File pom = getTestFile("src/test/resources/custom-attributes/pom.xml"); + assertTrue(pom.exists()); + + MdPageGeneratorMojo mdPageGeneratorMojo = (MdPageGeneratorMojo) lookupConfiguredMojo(pom, "generate"); + assertNotNull(mdPageGeneratorMojo); + assertEquals("md", mdPageGeneratorMojo.getInputFileExtension()); + + mdPageGeneratorMojo.execute(); + + File generatedMarkdown = new File(getBasedir(), expectedGeneratedHTMLFile); + assertTrue("Expected HTML file does not exist: " + generatedMarkdown, generatedMarkdown.exists()); + + String markDown = FileUtils.readFileToString(generatedMarkdown, "ISO-8859-15"); + assertNotNull(markDown); + assertEquals("

Lorem ipsum

\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "
header 1 header 2
data 1 data 2
data 3 data 3
\n" + + "
    \n" + + "
  • bullet item 1
  • \n" + + "
  • bullet item 2
  • \n" + + "
\n" + + "

Paragraph

\n" + + "
    \n" + + "
  1. numbered item 1
  2. \n" + + "
  3. numbered item 2
  4. \n" + + "
\n" + + "
\n" + + "

block quote paragraph text

\n" + + "
\n", markDown); + //assertTrue(markDown.contains("README.html")); + } + + public void testRecursiveProject() + throws Exception { + final String expectedGeneratedHTMLFileBaseDir = "/target/test-harness/recursive-project/target/html/"; + + File pom = getTestFile("src/test/resources/recursive-project/pom.xml"); + assertTrue(pom.exists()); + + MdPageGeneratorMojo mdPageGeneratorMojo = (MdPageGeneratorMojo) lookupConfiguredMojo(pom, "generate"); + assertNotNull(mdPageGeneratorMojo); + + mdPageGeneratorMojo.execute(); + + File index = new File(getBasedir(), expectedGeneratedHTMLFileBaseDir + "index.html"); + assertTrue(index.exists()); + + File page1 = new File(getBasedir(), expectedGeneratedHTMLFileBaseDir + "pages/page-1.html"); + assertTrue(page1.exists()); + + File page2 = new File(getBasedir(), expectedGeneratedHTMLFileBaseDir + "pages/page-2.html"); + assertTrue(page2.exists()); + + File page11 = new File(getBasedir(), expectedGeneratedHTMLFileBaseDir + "pages/embedded/page-1-1.html"); + assertTrue(page11.exists()); + } + + //public void testParsingTimeout() + // throws Exception { + // File pom = getTestFile("src/test/resources/timeout-project/pom.xml"); + // assertTrue(pom.exists()); + // + // MdPageGeneratorMojo mdPageGeneratorMojo = (MdPageGeneratorMojo) lookupConfiguredMojo(pom, "generate"); + // + // assertNotNull(mdPageGeneratorMojo); + // + // try { + // mdPageGeneratorMojo.execute(); + // fail(); + // } catch (Exception ex) { + // assertEquals(ParsingTimeoutException.class, ex.getCause().getClass()); + // } + //} + public void testSubstituteProject() throws Exception { + final String expectedGeneratedHTMLFile = "/target/test-harness/substitute-project/target/html/README.html"; + + File pom = getTestFile("src/test/resources/substitute-project/pom.xml"); + assertTrue(pom.exists()); + + MdPageGeneratorMojo mdPageGeneratorMojo = (MdPageGeneratorMojo) lookupConfiguredMojo(pom, "generate"); + assertNotNull(mdPageGeneratorMojo); + + mdPageGeneratorMojo.execute(); + + File generatedMarkdown = new File(getBasedir(), expectedGeneratedHTMLFile); + assertTrue("Expected HTML file does not exist: " + generatedMarkdown, generatedMarkdown.exists()); + + String html = FileUtils.readFileToString(generatedMarkdown); + + assertFalse("Shouldn't contain the var declaration", html.contains("headerSubstitution")); + assertFalse("Shouldn't contain the var declaration", html.contains("footerSubstitution")); + + assertFalse("Shouldn't contain the original var", html.contains("${headerSubstitution}")); + assertFalse("Shouldn't contain the original var", html.contains("${footerSubstitution}")); + + assertTrue("Should contain the replaced var", html.contains("The new header")); + assertTrue("Should contain the replaced var", html.contains("The new footer")); + + assertTrue("Should contain the replaced Maven variable 'substitute-project'", html.contains("substitute-project")); + + assertTrue("Should contain the original var 'beanId'", html.contains("${beanId}")); + assertTrue("Should contain the original var 'cacheManager'", html.contains("${cacheManager}")); + } + + @Test + public void testCopiedFiles() throws MojoExecutionException, IOException { + File sourceFolder = Files.createTempDir(); + try { + File destinationFolder = Files.createTempDir(); + try { + for (String folderName : new String[]{"folder1", "folder2", "folder3"}) { + final File subFolder = getSubFolder(sourceFolder, folderName); + subFolder.mkdir(); + for (String fileName : new String[]{"file1", "file2", "file3"}) { + + getSubFolder(subFolder, fileName).createNewFile(); + } + } + + printStructure("input", sourceFolder); + + MdPageGeneratorMojo mdPageGeneratorMojo = new MdPageGeneratorMojo(); + mdPageGeneratorMojo.setInputDirectory(sourceFolder.getAbsolutePath()); + mdPageGeneratorMojo.setOutputDirectory(destinationFolder.getAbsolutePath()); + mdPageGeneratorMojo.setCopyDirectories("folder1,folder3,folder4"); + + mdPageGeneratorMojo.execute(); + + printStructure("output", sourceFolder); + + Assert.assertTrue(getSubFolder(destinationFolder, "folder1").exists()); + Assert.assertFalse(getSubFolder(destinationFolder, "folder2").exists()); + Assert.assertTrue(getSubFolder(destinationFolder, "folder3").exists()); + Assert.assertFalse(getSubFolder(destinationFolder, "folder4").exists()); + + } finally { + deleteRecursively(destinationFolder); + } + } finally { + deleteRecursively(sourceFolder); + } + + } + + @Test + public void testCopiedFilesWithWildcard() throws MojoExecutionException, IOException { + File sourceFolder = Files.createTempDir(); + try { + File destinationFolder = Files.createTempDir(); + try { + for (String folderName : new String[]{"folder1", "folder2", "folder3"}) { + final File subFolder = getSubFolder(sourceFolder, folderName); + subFolder.mkdir(); + for (String fileName : new String[]{"file1", "file2", "file3"}) { + + getSubFolder(subFolder, fileName).createNewFile(); + } + } + printStructure("input", sourceFolder); + + MdPageGeneratorMojo mdPageGeneratorMojo = new MdPageGeneratorMojo(); + mdPageGeneratorMojo.setInputDirectory(sourceFolder.getAbsolutePath()); + mdPageGeneratorMojo.setOutputDirectory(destinationFolder.getAbsolutePath()); + mdPageGeneratorMojo.setCopyDirectories("folder*"); + + mdPageGeneratorMojo.execute(); + + printStructure("output", destinationFolder); + + Assert.assertTrue(getSubFolder(destinationFolder, "folder1").exists()); + Assert.assertTrue(getSubFolder(destinationFolder, "folder2").exists()); + Assert.assertTrue(getSubFolder(destinationFolder, "folder3").exists()); + Assert.assertFalse(getSubFolder(destinationFolder, "folder4").exists()); + + } finally { + deleteRecursively(destinationFolder); + } + } finally { + deleteRecursively(sourceFolder); + } + + } + + @Test + public void testCopiedFilesWithSubFoldersAndWildcard() throws MojoExecutionException, IOException { + File sourceFolder = Files.createTempDir(); + try { + File destinationFolder = Files.createTempDir(); + try { + for (String folderName : new String[]{"folder1", "folder2", "folder3"}) { + final File subFolder = getSubFolder(sourceFolder, folderName); + subFolder.mkdir(); + + createImageFolderWithFiles(subFolder); + + for (String subFolderName : new String[]{"folder1", "folder1", "folder1"}) { + final File subSubFolder = getSubFolder(subFolder, subFolderName); + + subSubFolder.mkdir(); + createImageFolderWithFiles(subSubFolder); + } + } + printStructure("input", sourceFolder); + + MdPageGeneratorMojo mdPageGeneratorMojo = new MdPageGeneratorMojo(); + mdPageGeneratorMojo.setInputDirectory(sourceFolder.getAbsolutePath()); + mdPageGeneratorMojo.setOutputDirectory(destinationFolder.getAbsolutePath()); + mdPageGeneratorMojo.setCopyDirectories("folder*/images"); + + mdPageGeneratorMojo.execute(); + + printStructure("output", destinationFolder); + + Assert.assertTrue(getSubFolder(destinationFolder, "folder1").exists()); + Assert.assertTrue(getSubFolder(destinationFolder, "folder2").exists()); + Assert.assertTrue(getSubFolder(destinationFolder, "folder3").exists()); + Assert.assertFalse(getSubFolder(destinationFolder, "folder4").exists()); + + for (String folderName : new String[]{"folder1", "folder2", "folder3"}) { + final File subFolder = getSubFolder(destinationFolder, folderName); + Assert.assertTrue(subFolder.exists()); + + verifyImageFolder(subFolder, "images"); + } + + } finally { + deleteRecursively(destinationFolder); + } + } finally { + deleteRecursively(sourceFolder); + } + + } + + @Test + public void testCopiedFilesWithSubFoldersAndDoubleStarWildcard() throws MojoExecutionException, IOException { + File sourceFolder = Files.createTempDir(); + try { + File destinationFolder = Files.createTempDir(); + try { + for (String folderName : new String[]{"folder1", "folder2", "folder3"}) { + final File subFolder = getSubFolder(sourceFolder, folderName); + subFolder.mkdir(); + + createImageFolderWithFiles(subFolder); + + for (String subFolderName : new String[]{"folder1", "folder2", "folder3"}) { + final File subSubFolder = getSubFolder(subFolder, subFolderName); + + subSubFolder.mkdir(); + createImageFolderWithFiles(subSubFolder); + } + } + + printStructure("input", sourceFolder); + + MdPageGeneratorMojo mdPageGeneratorMojo = new MdPageGeneratorMojo(); + mdPageGeneratorMojo.setInputDirectory(sourceFolder.getAbsolutePath()); + mdPageGeneratorMojo.setOutputDirectory(destinationFolder.getAbsolutePath()); + mdPageGeneratorMojo.setCopyDirectories("**/images"); + + mdPageGeneratorMojo.execute(); + + printStructure("output", destinationFolder); + + Assert.assertFalse(getSubFolder(destinationFolder, "folder4").exists()); + + for (String folderName : new String[]{"folder1", "folder2", "folder3"}) { + final File subFolder = getSubFolder(destinationFolder, folderName); + Assert.assertTrue(subFolder.exists()); + + verifyImageFolder(subFolder, "images"); + + for (String subFolderName : new String[]{"folder1", "folder2", "folder3"}) { + final File subSubFolder = getSubFolder(subFolder, subFolderName); + Assert.assertTrue(subSubFolder.exists()); + + verifyImageFolder(subSubFolder, "images"); + } + } + + } finally { + deleteRecursively(destinationFolder); + } + } finally { + deleteRecursively(sourceFolder); + } + + } + + private void verifyImageFolder(final File subFolder, String folderName) { + final File imageFolder = getSubFolder(subFolder, folderName); + Assert.assertTrue(imageFolder.exists()); + + for (String fileName : new String[]{"file1", "file2", "file3"}) { + + Assert.assertTrue(getSubFolder(imageFolder, fileName).exists()); + } + } + + private File createImageFolderWithFiles(final File subFolder) throws IOException { + final File subSubFolder = getSubFolder(subFolder, "images"); + subSubFolder.mkdir(); + for (String fileName : new String[]{"file1", "file2", "file3"}) { + + getSubFolder(subSubFolder, fileName).createNewFile(); + } + return subSubFolder; + } + + private static File getSubFolder(File sourceFolder, final String folderName) { + return sourceFolder.toPath().resolve(folderName).toFile(); + } + + private void deleteRecursively(File folder) { + for (File toDelete : folder.listFiles()) { + toDelete.delete(); + } + folder.delete(); + } + + private void printStructure(String type, File folderToPrint) { + System.out.println("file structure of '" + type + "'"); + Iterator files = FileUtils.iterateFiles(folderToPrint, null, true); + while (files.hasNext()) { + File file = files.next(); + System.out.println(folderToPrint.toPath().relativize(file.toPath())); + } + } +} diff --git a/src/test/resources/basic-project-custom-inout-directories/pom.xml b/src/test/resources/basic-project-custom-inout-directories/pom.xml index c038ed4..adf529c 100644 --- a/src/test/resources/basic-project-custom-inout-directories/pom.xml +++ b/src/test/resources/basic-project-custom-inout-directories/pom.xml @@ -3,7 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.ruleoftech.test + com.vladsch.flexmark.test basic 1.0-SNAPSHOT jar @@ -25,7 +25,7 @@ - com.ruleoftech + com.vladsch.flexmark markdown-page-generator-plugin @@ -43,4 +43,4 @@ -
\ No newline at end of file + diff --git a/src/test/resources/basic-project-extension/pom.xml b/src/test/resources/basic-project-extension/pom.xml index 85d5c35..2141e08 100644 --- a/src/test/resources/basic-project-extension/pom.xml +++ b/src/test/resources/basic-project-extension/pom.xml @@ -3,7 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.ruleoftech.test + com.vladsch.flexmark.test basic 1.0-SNAPSHOT jar @@ -25,7 +25,7 @@ - com.ruleoftech + com.vladsch.flexmark markdown-page-generator-plugin @@ -43,4 +43,4 @@ - \ No newline at end of file + diff --git a/src/test/resources/basic-project/pom.xml b/src/test/resources/basic-project/pom.xml index 5b385f9..add64ef 100644 --- a/src/test/resources/basic-project/pom.xml +++ b/src/test/resources/basic-project/pom.xml @@ -3,7 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.ruleoftech.test + com.vladsch.flexmark.test basic 1.0-SNAPSHOT jar @@ -25,7 +25,7 @@ - com.ruleoftech + com.vladsch.flexmark markdown-page-generator-plugin @@ -41,4 +41,4 @@ - \ No newline at end of file + diff --git a/src/test/resources/timeout-project/pom.xml b/src/test/resources/custom-attributes/pom.xml similarity index 69% rename from src/test/resources/timeout-project/pom.xml rename to src/test/resources/custom-attributes/pom.xml index 1c79208..ea6d7dc 100644 --- a/src/test/resources/timeout-project/pom.xml +++ b/src/test/resources/custom-attributes/pom.xml @@ -3,8 +3,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.ruleoftech.test - basic + com.vladsch.flexmark.test + substitute-project 1.0-SNAPSHOT jar Basic @@ -21,11 +21,11 @@ - ${project.basedir}/../../../../target/test-harness/timeout-project/target + ${project.basedir}/../../../../target/test-harness/custom-attributes/target - com.ruleoftech + com.vladsch.flexmark markdown-page-generator-plugin @@ -36,12 +36,15 @@ - ${basedir}/src/main/resources/markdown - ${project.build.directory}/html TABLES - 0 + + TableBlock|class=table table-striped + FencedCode|class=highlight + BlockQuote|class=red + OrderedListItem|style="color:red" + - \ No newline at end of file + diff --git a/src/test/resources/custom-attributes/src/main/resources/markdown/README.md b/src/test/resources/custom-attributes/src/main/resources/markdown/README.md new file mode 100644 index 0000000..c1a1154 --- /dev/null +++ b/src/test/resources/custom-attributes/src/main/resources/markdown/README.md @@ -0,0 +1,17 @@ +# Lorem ipsum + +| header 1 | header 2 | +|----------|----------| +| data 1 | data 2 | +| data 3 | data 3 | + +* bullet item 1 +* bullet item 2 + +Paragraph + +1. numbered item 1 +2. numbered item 2 + +> block quote +> paragraph text diff --git a/src/test/resources/encoding-project/pom.xml b/src/test/resources/encoding-project/pom.xml index 3b30a21..6c0ff47 100644 --- a/src/test/resources/encoding-project/pom.xml +++ b/src/test/resources/encoding-project/pom.xml @@ -3,7 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.ruleoftech.test + com.vladsch.flexmark.test basic 1.0-SNAPSHOT jar @@ -25,7 +25,7 @@ - com.ruleoftech + com.vladsch.flexmark markdown-page-generator-plugin @@ -43,4 +43,4 @@ - \ No newline at end of file + diff --git a/src/test/resources/recursive-project/pom.xml b/src/test/resources/recursive-project/pom.xml index 5c26600..509e324 100644 --- a/src/test/resources/recursive-project/pom.xml +++ b/src/test/resources/recursive-project/pom.xml @@ -3,7 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.ruleoftech.test + com.vladsch.flexmark.test basic 1.0-SNAPSHOT jar @@ -25,7 +25,7 @@ - com.ruleoftech + com.vladsch.flexmark markdown-page-generator-plugin @@ -42,4 +42,4 @@ - \ No newline at end of file + diff --git a/src/test/resources/substitute-project/pom.xml b/src/test/resources/substitute-project/pom.xml index 9efee5d..98523e7 100644 --- a/src/test/resources/substitute-project/pom.xml +++ b/src/test/resources/substitute-project/pom.xml @@ -3,7 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.ruleoftech.test + com.vladsch.flexmark.test substitute-project 1.0-SNAPSHOT jar @@ -25,7 +25,7 @@ - com.ruleoftech + com.vladsch.flexmark markdown-page-generator-plugin @@ -44,4 +44,4 @@ - \ No newline at end of file + diff --git a/src/test/resources/timeout-project/src/main/resources/markdown/README.md b/src/test/resources/timeout-project/src/main/resources/markdown/README.md deleted file mode 100644 index 2a01cf4..0000000 --- a/src/test/resources/timeout-project/src/main/resources/markdown/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# Lorem ipsum - -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. -Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. -Proin porttitor, orci nec nonummy molestie, enim est eleifend mi, non fermentum diam nisl sit amet erat. -Duis semper. Duis arcu massa, scelerisque vitae, consequat in, pretium a, enim. Pellentesque congue. Ut in risus volutpat libero pharetra tempor. -Cras vestibulum bibendum augue. Praesent egestas leo in pede. Praesent blandit odio eu enim. Pellentesque sed dui ut augue blandit sodales. -Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aliquam nibh. -Mauris ac mauris sed pede pellentesque fermentum. Maecenas adipiscing ante non diam sodales hendrerit. \ No newline at end of file