Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration to flexmark-java #25

Merged
merged 45 commits into from
Oct 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
4d4c891
first commit after flexmark migration
vsch Jan 24, 2017
7be5271
change .travis.yml
vsch Jan 24, 2017
bd2894c
change .travis.yml
vsch Jan 24, 2017
dd7cde6
change .travis.yml
vsch Jan 24, 2017
213dcb7
change .travis.yml
vsch Jan 24, 2017
be3e22a
update maven central query params
vsch Jan 25, 2017
3339930
add ability to set custom attributes
vsch Jan 31, 2017
578e464
update readme
vsch Jan 31, 2017
0098063
update readme
vsch Jan 31, 2017
ae7d3e2
update readme
vsch Jan 31, 2017
b5de35c
update readme
vsch Jan 31, 2017
575d269
update readme
vsch Jan 31, 2017
6c20eba
update flexmark-java 0.13.4
vsch Feb 7, 2017
2b83d2f
update flexmark-java 0.13.6
vsch Feb 7, 2017
e16c1aa
update flexmark-java 0.13.7, HARDWRAPS fix
vsch Feb 8, 2017
904b861
update flexmark-java 0.14.0, QUOTES and SMARTS implemented
vsch Feb 9, 2017
e738f95
update flexmark-java 0.15.4, fix autolinks when only protocol prefix
vsch Feb 27, 2017
3d64366
update flexmark to 0.18.0
vsch Mar 8, 2017
890dc94
update flexmark to 0.18.2, parsing bugs
vsch Mar 11, 2017
2a610e5
update flexmark to 0.19.6, ref image and link rendering bug
vsch Jun 1, 2017
2e3bf9c
update flexmark to 0.21.0
vsch Jul 11, 2017
01ab1cb
update flexmark to 0.22.2 with deep HTML block parsing
vsch Jul 12, 2017
365d65a
update flexmark to 0.22.4 with deep HTML block parsing
vsch Jul 13, 2017
72467f5
- pulled fily copy task into a separate class to enabled testing the …
Rhiath Jul 13, 2017
47fea22
Revert "- pulled fily copy task into a separate class to enabled test…
Rhiath Jul 15, 2017
ab37876
- disabled GPG signing so project builds on other machines as well
Rhiath Jul 15, 2017
e1e6fc0
- introduced method to determine which folders to copy
Rhiath Jul 15, 2017
1f59246
- added getters and setter to initialize mojo during tests
Rhiath Jul 16, 2017
5d7916d
- added test for copying files (previously no test coverage)
Rhiath Jul 16, 2017
c73c817
- added test for copying folder by wildcard
Rhiath Jul 23, 2017
00a8d9d
- bugfix: replaced create file with make directory
Rhiath Jul 23, 2017
e82e8c2
- refactored test code
Rhiath Jul 23, 2017
f219190
- added support for wildcard filters
Rhiath Jul 23, 2017
83915a5
- added generation of jacoco test coverage report
Rhiath Jul 23, 2017
fde7778
- reverted changes that were necessary to build plugin locally
Rhiath Jul 23, 2017
70b3e93
- added documentation about the wildcards in copy directories
Rhiath Jul 23, 2017
412b375
Merge pull request #3 from Rhiath/master
vsch Jul 24, 2017
7ba18ec
merge PR for recursive file copy
vsch Jul 25, 2017
5041187
Fix bad practices in README.md
michael-o Sep 18, 2017
3366a31
Merge pull request #7 from michael-o/master
vsch Sep 20, 2017
459184c
merge PR for readme changes
vsch Sep 20, 2017
99236b5
prep release
vsch Sep 20, 2017
ea670b7
remove erroneous restrictive copyright blocks
vsch Oct 31, 2017
89a153f
Merge branch 'master' into master
walokra Oct 31, 2017
34ac169
Merge branch 'master' into master
walokra Oct 31, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ release.properties
.idea
*.iml

/pom.xml.versionsBackup
/markdown-page-generator-plugin.wiki/
3 changes: 2 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
245 changes: 225 additions & 20 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -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)

Expand All @@ -18,7 +20,8 @@ Plugin Information:
</plugin>
```

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:

Expand Down Expand Up @@ -88,23 +91,106 @@ Configuration options:
</html>
```

* `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
<attributes>
<attribute>TableBlock|class=table table-striped table-bordered</attribute>
<attribute>BlockQuote|class=red</attribute>
<attribute>OrderedListItem|style="color:red;"</attribute>
</attributes>
```

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
Expand All @@ -118,22 +204,131 @@ 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 `<p>` 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: `<h1><a
name="header"></a>header</h1>`

* `EXTANCHORLINKS_WRAP`: used in conjunction with above to create an anchor that wraps header
content: `<h1><a name="header">header</a></h1>`

* `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
<p>This paragraph has a footnote<sup id="fnref-1"><a href="#fn-1" class="footnote-ref">1</a></sup> and another footnote<sup id="fnref-2"><a href="#fn-2" class="footnote-ref">2</a></sup>.</p>
<p>This one has more but out of sequence<sup id="fnref-3"><a href="#fn-3" class="footnote-ref">3</a></sup> and<sup id="fnref-4"><a href="#fn-4" class="footnote-ref">4</a></sup>. </p>
<div class="footnotes">
<hr/>
<ol>
<li id="fn-1"><p>Footnote 1<a href="#fnref-1" class="footnote-backref">&#8617;</a></p></li>
<li id="fn-2"><p>Footnote 2 with a bit more text and another continuation line<a href="#fnref-2" class="footnote-backref">&#8617;</a></p></li>
<li id="fn-3"><p>Out of sequence footnote<a href="#fnref-3" class="footnote-backref">&#8617;</a></p></li>
<li id="fn-4"><p>Have one that is used.<a href="#fnref-4" class="footnote-backref">&#8617;</a></p></li>
</ol>
</div>
```

to look like this:

<div>
<hr/>
<p>This paragraph has a footnote<sup id="fnref-1"><a href="#fn-1" class="footnote-ref">1</a></sup> and another footnote<sup id="fnref-2"><a href="#fn-2" class="footnote-ref">2</a></sup>.</p>
<p>This one has more but out of sequence<sup id="fnref-3"><a href="#fn-3" class="footnote-ref">3</a></sup> and<sup id="fnref-4"><a href="#fn-4" class="footnote-ref">4</a></sup>. </p>
<hr/>
<div class="footnotes">
<ol style="list-style-type: decimal;">
<li id="fn-1"><p>Footnote 1<a href="#fnref-1" class="footnote-backref">&#8617;</a></p></li>
<li id="fn-2"><p>Footnote 2 with a bit more text and another continuation line<a href="#fnref-2" class="footnote-backref">&#8617;</a></p></li>
<li id="fn-3"><p>Out of sequence footnote<a href="#fnref-3" class="footnote-backref">&#8617;</a></p></li>
<li id="fn-4"><p>Have one that is used.<a href="#fnref-4" class="footnote-backref">&#8617;</a></p></li>
</ol>
</div>
</div>

* `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`

* outputEncoding: Charset-Name used for writing the html-output, default:
`${project.build.sourceEncoding}` or `Default-Charset`

The output will be:

* `target/html/name_of_file.html`

## Configuration
Expand Down Expand Up @@ -219,11 +414,21 @@ Input- and Output-Encoding can be specified by:
</goals>
</execution>
</executions>
<configuration>
<inputDirectory>${basedir}/src/test/resources/encoding-project/src/main/resources/markdown</inputDirectory>
<outputDirectory>${basedir}/target/test-harness/encoding-project/html</outputDirectory>
<inputEncoding>UTF-8</inputEncoding>
<outputEncoding>ISO-8859-15</outputEncoding>
</configuration>
<configuration>
<inputDirectory>${basedir}/src/test/resources/encoding-project/src/main/resources/markdown</inputDirectory>
<outputDirectory>${basedir}/target/test-harness/encoding-project/html</outputDirectory>
<inputEncoding>UTF-8</inputEncoding>
<outputEncoding>ISO-8859-15</outputEncoding>
</configuration>
</plugin>
```

[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
Loading