Author: hboutemy
Date: Sat Mar 25 20:30:29 2017
New Revision: 1788689

URL: http://svn.apache.org/viewvc?rev=1788689&view=rev
Log:
[DOXIA-554] migrated Markdown parser from pegdown to flaxmark-java
Submitted by: Vladimir Schneider

Added:
    
maven/doxia/doxia/trunk/doxia-modules/doxia-module-markdown/src/main/java/org/apache/maven/doxia/module/markdown/FlexmarkDoxiaExtension.java
   (with props)
    
maven/doxia/doxia/trunk/doxia-modules/doxia-module-markdown/src/main/java/org/apache/maven/doxia/module/markdown/FlexmarkDoxiaNodeRenderer.java
   (with props)
Removed:
    
maven/doxia/doxia/trunk/doxia-modules/doxia-module-markdown/src/main/java/org/apache/maven/doxia/module/markdown/MarkdownToDoxiaHtmlSerializer.java
Modified:
    maven/doxia/doxia/trunk/doxia-modules/doxia-module-markdown/pom.xml
    
maven/doxia/doxia/trunk/doxia-modules/doxia-module-markdown/src/main/java/org/apache/maven/doxia/module/markdown/MarkdownParser.java
    
maven/doxia/doxia/trunk/doxia-modules/doxia-module-markdown/src/site/apt/index.apt
    
maven/doxia/doxia/trunk/doxia-modules/doxia-module-markdown/src/test/java/org/apache/maven/doxia/module/markdown/MarkdownParserTest.java
    
maven/doxia/doxia/trunk/doxia-modules/doxia-module-markdown/src/test/resources/html-content.md
    
maven/doxia/doxia/trunk/doxia-modules/doxia-module-markdown/src/test/resources/test.md
    maven/doxia/doxia/trunk/pom.xml

Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-markdown/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-markdown/pom.xml?rev=1788689&r1=1788688&r2=1788689&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-markdown/pom.xml 
(original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-markdown/pom.xml Sat Mar 
25 20:30:29 2017
@@ -38,6 +38,12 @@ under the License.
 
   <contributors>
     <contributor>
+      <name>Vladimir Schneider</name>
+      <email>vladi...@vladsch.com</email>
+      <organization>vladsch.com</organization>
+      <organizationUrl>https://vladsch.com/</organizationUrl>
+    </contributor>
+    <contributor>
       <name>Julien Nicoulaud</name>
       <email>julien.nicoul...@gmail.com</email>
       <timezone>+1</timezone>
@@ -45,11 +51,15 @@ under the License.
     </contributor>
   </contributors>
 
+  <properties>
+    <maven.compiler.target>1.7</maven.compiler.target><!-- required by 
flexmark -->
+  </properties>
+
   <dependencies>
     <dependency>
-      <groupId>org.pegdown</groupId>
-      <artifactId>pegdown</artifactId>
-      <version>1.2.1</version>
+      <groupId>com.vladsch.flexmark</groupId>
+      <artifactId>flexmark-all</artifactId>
+      <version>0.18.4</version>
     </dependency>
     <dependency>
       <groupId>org.apache.maven.doxia</groupId>
@@ -60,5 +70,4 @@ under the License.
       <artifactId>plexus-utils</artifactId>
     </dependency>
   </dependencies>
-
 </project>

Added: 
maven/doxia/doxia/trunk/doxia-modules/doxia-module-markdown/src/main/java/org/apache/maven/doxia/module/markdown/FlexmarkDoxiaExtension.java
URL: 
http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-markdown/src/main/java/org/apache/maven/doxia/module/markdown/FlexmarkDoxiaExtension.java?rev=1788689&view=auto
==============================================================================
--- 
maven/doxia/doxia/trunk/doxia-modules/doxia-module-markdown/src/main/java/org/apache/maven/doxia/module/markdown/FlexmarkDoxiaExtension.java
 (added)
+++ 
maven/doxia/doxia/trunk/doxia-modules/doxia-module-markdown/src/main/java/org/apache/maven/doxia/module/markdown/FlexmarkDoxiaExtension.java
 Sat Mar 25 20:30:29 2017
@@ -0,0 +1,50 @@
+package org.apache.maven.doxia.module.markdown;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+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;
+
+/**
+ * Implements flexmark-java extension to render fenced code and indented code 
using doxia format
+ */
+class FlexmarkDoxiaExtension implements HtmlRenderer.HtmlRendererExtension
+{
+    public static final DataKey<String> INPUT_FILE_EXTENSION = new 
DataKey<String>( "INPUT_FILE_EXTENSION", "md" );
+
+    @Override
+    public void rendererOptions( final MutableDataHolder options )
+    {
+
+    }
+
+    @Override
+    public void extend( HtmlRenderer.Builder rendererBuilder, String 
rendererType )
+    {
+        rendererBuilder.nodeRendererFactory( new 
FlexmarkDoxiaNodeRenderer.Factory() );
+    }
+
+    public static Extension create()
+    {
+        return new FlexmarkDoxiaExtension();
+    }
+}

Propchange: 
maven/doxia/doxia/trunk/doxia-modules/doxia-module-markdown/src/main/java/org/apache/maven/doxia/module/markdown/FlexmarkDoxiaExtension.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: 
maven/doxia/doxia/trunk/doxia-modules/doxia-module-markdown/src/main/java/org/apache/maven/doxia/module/markdown/FlexmarkDoxiaNodeRenderer.java
URL: 
http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-markdown/src/main/java/org/apache/maven/doxia/module/markdown/FlexmarkDoxiaNodeRenderer.java?rev=1788689&view=auto
==============================================================================
--- 
maven/doxia/doxia/trunk/doxia-modules/doxia-module-markdown/src/main/java/org/apache/maven/doxia/module/markdown/FlexmarkDoxiaNodeRenderer.java
 (added)
+++ 
maven/doxia/doxia/trunk/doxia-modules/doxia-module-markdown/src/main/java/org/apache/maven/doxia/module/markdown/FlexmarkDoxiaNodeRenderer.java
 Sat Mar 25 20:30:29 2017
@@ -0,0 +1,148 @@
+package org.apache.maven.doxia.module.markdown;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import com.vladsch.flexmark.ast.FencedCodeBlock;
+import com.vladsch.flexmark.ast.IndentedCodeBlock;
+import com.vladsch.flexmark.html.CustomNodeRenderer;
+import com.vladsch.flexmark.html.HtmlWriter;
+import com.vladsch.flexmark.html.renderer.NodeRenderer;
+import com.vladsch.flexmark.html.renderer.NodeRendererContext;
+import com.vladsch.flexmark.html.renderer.NodeRendererFactory;
+import com.vladsch.flexmark.html.renderer.NodeRenderingHandler;
+import com.vladsch.flexmark.util.options.DataHolder;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * The node renderer that renders all the core nodes (comes last in the order 
of node renderers).
+ */
+@SuppressWarnings( "WeakerAccess" )
+class FlexmarkDoxiaNodeRenderer implements NodeRenderer
+{
+    public FlexmarkDoxiaNodeRenderer( DataHolder options )
+    {
+    }
+
+    @Override
+    public Set<NodeRenderingHandler<?>> getNodeRenderingHandlers()
+    {
+        //noinspection unchecked
+        return new HashSet<NodeRenderingHandler<?>>( Arrays.asList(
+                new NodeRenderingHandler<IndentedCodeBlock>( 
IndentedCodeBlock.class,
+                        new CustomNodeRenderer<IndentedCodeBlock>()
+                        {
+                            @Override
+                            public void render( IndentedCodeBlock node, 
NodeRendererContext context, HtmlWriter html )
+                            {
+                                FlexmarkDoxiaNodeRenderer.this.render( node, 
context, html );
+                            }
+                        } ),
+                new NodeRenderingHandler<FencedCodeBlock>( 
FencedCodeBlock.class,
+                        new CustomNodeRenderer<FencedCodeBlock>()
+                        {
+                            @Override
+                            public void render( FencedCodeBlock node, 
NodeRendererContext context, HtmlWriter html )
+                            {
+                                FlexmarkDoxiaNodeRenderer.this.render( node, 
context, html );
+                            }
+                        } )
+        ) );
+    }
+
+    private void render( IndentedCodeBlock node, NodeRendererContext context, 
HtmlWriter html )
+    {
+        html.line();
+        html.attr( "class", "source" ).tag( "div" );
+        html.srcPosWithEOL( node.getChars() ).withAttr().tag( "pre" 
).openPre();
+
+        String noLanguageClass = 
context.getHtmlOptions().noLanguageClass.trim();
+        if ( !noLanguageClass.isEmpty() )
+        {
+            html.attr( "class", noLanguageClass );
+        }
+
+        
//html.srcPosWithEOL(node.getContentChars()).withAttr(CoreNodeRenderer.CODE_CONTENT).tag("code");
+        String s = 
node.getContentChars().trimTailBlankLines().normalizeEndWithEOL();
+        while ( !s.isEmpty() && s.charAt( 0 ) == '\n' )
+        {
+            html.raw( "<br/>" );
+            s = s.substring( 1 );
+        }
+        html.text( s );
+
+        //html.tag("/code");
+        html.tag( "/pre" ).closePre();
+        html.tag( "/div" );
+        html.line();
+    }
+
+    private void render( FencedCodeBlock node, NodeRendererContext context, 
HtmlWriter html )
+    {
+        html.line();
+        html.attr( "class", "source" ).tag( "div" );
+        html.srcPosWithTrailingEOL( node.getChars() ).withAttr().tag( "pre" 
).openPre();
+
+        //BasedSequence info = node.getInfo();
+        //if (info.isNotNull() && !info.isBlank()) {
+        //    int space = info.indexOf(' ');
+        //    BasedSequence language;
+        //    if (space == -1) {
+        //        language = info;
+        //    } else {
+        //        language = info.subSequence(0, space);
+        //    }
+        //    html.attr("class", context.getHtmlOptions().languageClassPrefix 
+ language.unescape());
+        //} else  {
+        //    String noLanguageClass = 
context.getHtmlOptions().noLanguageClass.trim();
+        //    if (!noLanguageClass.isEmpty()) {
+        //        html.attr("class", noLanguageClass);
+        //    }
+        //}
+
+        
//html.srcPosWithEOL(node.getContentChars()).withAttr(CoreNodeRenderer.CODE_CONTENT).tag("code");
+        String s = node.getContentChars().normalizeEOL();
+        while ( !s.isEmpty() && s.charAt( 0 ) == '\n' )
+        {
+            html.raw( "<br/>" );
+            s = s.substring( 1 );
+        }
+        html.text( s );
+
+        //html.tag("/code");
+        html.tag( "/pre" ).closePre();
+        html.tag( "/div" );
+        html.line();
+    }
+
+    /**
+     * Factory for doxia node renderer
+     */
+    public static class Factory implements NodeRendererFactory
+    {
+        @Override
+        public NodeRenderer create( final DataHolder options )
+        {
+            return new FlexmarkDoxiaNodeRenderer( options );
+        }
+    }
+}

Propchange: 
maven/doxia/doxia/trunk/doxia-modules/doxia-module-markdown/src/main/java/org/apache/maven/doxia/module/markdown/FlexmarkDoxiaNodeRenderer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: 
maven/doxia/doxia/trunk/doxia-modules/doxia-module-markdown/src/main/java/org/apache/maven/doxia/module/markdown/MarkdownParser.java
URL: 
http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-markdown/src/main/java/org/apache/maven/doxia/module/markdown/MarkdownParser.java?rev=1788689&r1=1788688&r2=1788689&view=diff
==============================================================================
--- 
maven/doxia/doxia/trunk/doxia-modules/doxia-module-markdown/src/main/java/org/apache/maven/doxia/module/markdown/MarkdownParser.java
 (original)
+++ 
maven/doxia/doxia/trunk/doxia-modules/doxia-module-markdown/src/main/java/org/apache/maven/doxia/module/markdown/MarkdownParser.java
 Sat Mar 25 20:30:29 2017
@@ -19,6 +19,15 @@ package org.apache.maven.doxia.module.ma
  * under the License.
  */
 
+import com.vladsch.flexmark.Extension;
+import com.vladsch.flexmark.ast.Heading;
+import com.vladsch.flexmark.ast.HtmlCommentBlock;
+import com.vladsch.flexmark.ast.Node;
+import com.vladsch.flexmark.ast.util.TextCollectingVisitor;
+import com.vladsch.flexmark.html.HtmlRenderer;
+import com.vladsch.flexmark.profiles.pegdown.Extensions;
+import com.vladsch.flexmark.profiles.pegdown.PegdownOptionsAdapter;
+import com.vladsch.flexmark.util.options.MutableDataHolder;
 import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.maven.doxia.markup.HtmlMarkup;
@@ -31,30 +40,24 @@ import org.codehaus.plexus.component.ann
 import org.codehaus.plexus.component.annotations.Requirement;
 import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.xml.pull.XmlPullParser;
-import org.pegdown.Extensions;
-import org.pegdown.PegDownProcessor;
-import org.pegdown.ast.HeaderNode;
-import org.pegdown.ast.HtmlBlockNode;
-import org.pegdown.ast.Node;
-import org.pegdown.ast.RootNode;
-import org.pegdown.ast.SuperNode;
-import org.pegdown.ast.TextNode;
 
 import java.io.IOException;
 import java.io.Reader;
 import java.io.StringReader;
+import java.util.ArrayList;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 /**
  * Implementation of {@link org.apache.maven.doxia.parser.Parser} for Markdown 
documents.
  * <p/>
- * Defers effective parsing to the <a href="http://pegdown.org";>PegDown 
library</a>, which generates HTML content
- * then delegates parsing of this content to a slightly modified Doxia Xhtml 
parser.
+ * Defers effective parsing to the <a 
href="https://github.com/vsch/flexmark-java";>flexmark-java library</a>,
+ * which generates HTML content then delegates parsing of this content to a 
slightly modified Doxia Xhtml parser.
+ * (before 1.8, the <a href="http://pegdown.org";>PegDown library</a> was used)
  *
+ * @author Vladimir Schneider <vladi...@vladsch.com>
  * @author Julien Nicoulaud <julien.nicoul...@gmail.com>
  * @since 1.3
- * @see MarkdownToDoxiaHtmlSerializer
  */
 @Component( role = Parser.class, hint = "markdown" )
 public class MarkdownParser
@@ -67,14 +70,6 @@ public class MarkdownParser
     public static final String ROLE_HINT = "markdown";
 
     /**
-     * The {@link PegDownProcessor} used to convert Pegdown documents to HTML.
-     * @deprecated this is not threadsafe, create always a new one or sync 
appropriately
-     */
-    @Deprecated
-    protected static final PegDownProcessor PEGDOWN_PROCESSOR =
-        new PegDownProcessor( Extensions.ALL & ~Extensions.HARDWRAPS, 
Long.MAX_VALUE );
-
-    /**
      * Regex that identifies a multimarkdown-style metadata section at the 
start of the document
      */
     private static final String MULTI_MARKDOWN_METADATA_SECTION =
@@ -101,14 +96,14 @@ public class MarkdownParser
     }
 
     @Requirement
-    private PegDownHtmlParser parser;
+    private MarkdownHtmlParser parser;
 
     public void parse( Reader source, Sink sink )
         throws ParseException
     {
         try
         {
-            // Markdown to HTML (using Pegdown library)
+            // Markdown to HTML (using flexmark-java library)
             String html = toHtml( source );
             // then HTML to Sink API
             parser.parse( new StringReader( html ), sink );
@@ -120,18 +115,35 @@ public class MarkdownParser
     }
 
     /**
-     * uses PegDown library to parse content and generate HTML output.
+     * uses flexmark-java library to parse content and generate HTML output.
      *
      * @param source the Markdown source
-     * @return HTML content generated by PegDown
-     * @throws IOException
-     * @see MarkdownToDoxiaHtmlSerializer
+     * @return HTML content generated by flexmark-java
+     * @throws IOException passed through
      */
     private String toHtml( Reader source )
         throws IOException
     {
         String text = IOUtil.toString( source );
-        StringBuilder html = new StringBuilder( text.length() * 2 );
+        MutableDataHolder flexmarkOptions = 
PegdownOptionsAdapter.flexmarkOptions(
+                Extensions.ALL & ~( Extensions.HARDWRAPS | 
Extensions.ANCHORLINKS ) ).toMutable();
+        ArrayList<Extension> extensions = new ArrayList<Extension>();
+        for ( Extension extension : flexmarkOptions.get( 
com.vladsch.flexmark.parser.Parser.EXTENSIONS ) )
+        {
+            extensions.add( extension );
+        }
+
+        extensions.add( FlexmarkDoxiaExtension.create() );
+        flexmarkOptions.set( com.vladsch.flexmark.parser.Parser.EXTENSIONS, 
extensions );
+        flexmarkOptions.set( HtmlRenderer.HTML_BLOCK_OPEN_TAG_EOL, false );
+        flexmarkOptions.set( HtmlRenderer.HTML_BLOCK_CLOSE_TAG_EOL, false );
+        flexmarkOptions.set( HtmlRenderer.MAX_TRAILING_BLANK_LINES, -1 );
+
+        com.vladsch.flexmark.parser.Parser parser = 
com.vladsch.flexmark.parser.Parser.builder( flexmarkOptions )
+                .build();
+        HtmlRenderer renderer = HtmlRenderer.builder( flexmarkOptions 
).build();
+
+        StringBuilder html = new StringBuilder( 1000 );
         html.append( "<html>" );
         html.append( "<head>" );
         Pattern metadataPattern = Pattern.compile( 
MULTI_MARKDOWN_METADATA_SECTION, Pattern.MULTILINE );
@@ -196,76 +208,49 @@ public class MarkdownParser
                 text = text.substring( metadataMatcher.end() );
             }
         }
-        PegDownProcessor processor = new PegDownProcessor( Extensions.ALL & 
~Extensions.HARDWRAPS, Long.MAX_VALUE );
-        RootNode rootNode = processor.parseMarkdown( text.toCharArray() );
-        if ( !haveTitle && rootNode.getChildren().size() > 0 )
+
+        Node rootNode = parser.parse( text );
+        String markdownHtml = renderer.render( rootNode );
+
+        if ( !haveTitle && rootNode.hasChildren() )
         {
             // use the first (non-comment) node only if it is a heading
-            int i = 0;
-            Node firstNode = null;
-            while ( i < rootNode.getChildren().size() && isHtmlComment(
-                ( firstNode = rootNode.getChildren().get( i ) ) ) )
+            Node firstNode = rootNode.getFirstChild();
+            while ( firstNode != null && !( firstNode instanceof Heading ) )
             {
-                i++;
+                if ( !( firstNode instanceof HtmlCommentBlock ) )
+                {
+                    break;
+                }
+                firstNode = firstNode.getNext();
             }
-            if ( firstNode instanceof HeaderNode )
+
+            if ( firstNode instanceof Heading )
             {
                 html.append( "<title>" );
-                html.append( StringEscapeUtils.escapeXml( nodeText( firstNode 
) ) );
+                TextCollectingVisitor collectingVisitor = new 
TextCollectingVisitor();
+                String headingText = collectingVisitor.collectAndGetText( 
firstNode );
+                html.append( StringEscapeUtils.escapeXml( headingText ) );
                 html.append( "</title>" );
             }
         }
         html.append( "</head>" );
         html.append( "<body>" );
-        html.append( new MarkdownToDoxiaHtmlSerializer().toHtml( rootNode ) );
+        html.append( markdownHtml );
         html.append( "</body>" );
         html.append( "</html>" );
 
         return html.toString();
     }
 
-    public static boolean isHtmlComment( Node node )
-    {
-        if ( node instanceof HtmlBlockNode )
-        {
-            HtmlBlockNode blockNode = (HtmlBlockNode) node;
-            return blockNode.getText().startsWith( "<!--" );
-        }
-        return false;
-    }
-
-    public static String nodeText( Node node )
-    {
-        StringBuilder builder = new StringBuilder();
-        if ( node instanceof TextNode )
-        {
-            builder.append( TextNode.class.cast( node ).getText() );
-        }
-        else
-        {
-            for ( Node n : node.getChildren() )
-            {
-                if ( n instanceof TextNode )
-                {
-                    builder.append( TextNode.class.cast( n ).getText() );
-                }
-                else if ( n instanceof SuperNode )
-                {
-                    builder.append( nodeText( n ) );
-                }
-            }
-        }
-        return builder.toString();
-    }
-
     /**
-     * Internal parser for HTML generated by PegDown library.
+     * Internal parser for HTML generated by the Markdown library.
      */
-    @Component( role = PegDownHtmlParser.class )
-    public static class PegDownHtmlParser
+    @Component( role = MarkdownHtmlParser.class )
+    public static class MarkdownHtmlParser
         extends XhtmlParser
     {
-        public PegDownHtmlParser()
+        public MarkdownHtmlParser()
         {
             super();
         }

Modified: 
maven/doxia/doxia/trunk/doxia-modules/doxia-module-markdown/src/site/apt/index.apt
URL: 
http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-markdown/src/site/apt/index.apt?rev=1788689&r1=1788688&r2=1788689&view=diff
==============================================================================
--- 
maven/doxia/doxia/trunk/doxia-modules/doxia-module-markdown/src/site/apt/index.apt
 (original)
+++ 
maven/doxia/doxia/trunk/doxia-modules/doxia-module-markdown/src/site/apt/index.apt
 Sat Mar 25 20:30:29 2017
@@ -1,9 +1,9 @@
  -----
  doxia-module-markdown
  -----
- Julien Nicoulaud <julien.nicoul...@gmail.com>
+ Vladimir Schneider <vladi...@vladsch.com>, Julien Nicoulaud 
<julien.nicoul...@gmail.com>
  ------
- 2011-05-28
+ 2017-03-04
  ------
 
 ~~ Licensed to the Apache Software Foundation (ASF) under one
@@ -32,7 +32,31 @@ doxia-module-markdown
   It is supported by a large panel of websites, text editors/IDEs and 
converter tools.
   Markdown format is only supported as Doxia source format.
 
-  <<References>>
+* Notice
+
+  This Doxia module requires Java 7 for 
{{{http://github.com/vsch/flexmark-java}flexmark-java}} parser,
+  unlike other Doxia modules which require only Java 6.
+
+  If your project requires Java 6 to launch Maven, you may consider the use of 
doxia-module-markdown version 1.7.
+
++----+
+  <plugin>
+    <groupId>org.apache.maven.plugins</groupId>
+    <artifactId>maven-site-plugin</artifactId>
+    <dependencies>
+      <dependency>
+        <groupId>org.apache.maven.doxia</groupId>
+        <artifactId>doxia-module-markdown</artifactId>
+        <version>1.7</version><!-- to keep Java 6 compatibility-->
+      </dependency>
+    </dependencies>
+  </plugin>
++----+
+  
+  In this situation, you should be aware that Pegdown has known technical 
issues and that
+  {{{http://pegdown.org}"Pegdown has reached its end of life"}}.
+
+* References
 
    * {{{http://daringfireball.net/projects/markdown}Markdown project website}}
 
@@ -40,4 +64,8 @@ doxia-module-markdown
 
    * {{{http://xbeta.org/wiki/show/Markdown}Markdown wiki}}
 
-   * {{{http://pegdown.org}Pegdown}}, the library used by this Doxia module
+   * {{{http://github.com/vsch/flexmark-java}flexmark-java}}, the library used 
by this Doxia module
+     in {{{http://pegdown.org}Pegdown}} compatibility mode
+
+   * {{{http://pegdown.org}Pegdown}} a deprecated Markdown processing library 
used in previous
+     doxia-module-markdown versions 1.3 to 1.7

Modified: 
maven/doxia/doxia/trunk/doxia-modules/doxia-module-markdown/src/test/java/org/apache/maven/doxia/module/markdown/MarkdownParserTest.java
URL: 
http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-markdown/src/test/java/org/apache/maven/doxia/module/markdown/MarkdownParserTest.java?rev=1788689&r1=1788688&r2=1788689&view=diff
==============================================================================
--- 
maven/doxia/doxia/trunk/doxia-modules/doxia-module-markdown/src/test/java/org/apache/maven/doxia/module/markdown/MarkdownParserTest.java
 (original)
+++ 
maven/doxia/doxia/trunk/doxia-modules/doxia-module-markdown/src/test/java/org/apache/maven/doxia/module/markdown/MarkdownParserTest.java
 Sat Mar 25 20:30:29 2017
@@ -173,7 +173,7 @@ public class MarkdownParserTest
     {
         Iterator<SinkEventElement> it = parseFileToEventTestingSink( "list" 
).getEventList().iterator();
 
-        assertEquals( it, "head", "head_", "body", "list", "text", "listItem", 
"text", "listItem_", "text", "listItem", "text",
+        assertEquals( it, "head", "head_", "body", "list", "text", "listItem", 
"text", "listItem_", "listItem", "text",
                       "listItem_", "text", "list_", "body_" );
 
         assertFalse( it.hasNext() );
@@ -189,7 +189,7 @@ public class MarkdownParserTest
     {
         Iterator<SinkEventElement> it = parseFileToEventTestingSink( 
"numbered-list" ).getEventList().iterator();
 
-        assertEquals( it, "head", "head_", "body", "numberedList", "text", 
"numberedListItem", "text", "numberedListItem_", "text",
+        assertEquals( it, "head", "head_", "body", "numberedList", "text", 
"numberedListItem", "text", "numberedListItem_",
                       "numberedListItem", "text", "numberedListItem_", "text", 
"numberedList_", "body_" );
 
         assertFalse( it.hasNext() );
@@ -241,7 +241,7 @@ public class MarkdownParserTest
         Iterator<SinkEventElement> it = parseFileToEventTestingSink( 
"comment-before-heading" ).getEventList().iterator();
 
         // NOTE: H1 is rendered as "unknown" and H2 is "section1" (see 
DOXIA-203)
-        assertEquals( it, "head", "title", "text", "title_", "head_", "body", 
"comment", "unknown", "text",
+        assertEquals( it, "head", "title", "text", "title_", "head_", "body", 
"comment", "text", "unknown", "text",
                       "unknown", "paragraph", "text", "link", "text", "link_", 
"text", "paragraph_", "body_" );
 
         assertFalse( it.hasNext() );
@@ -304,6 +304,6 @@ public class MarkdownParserTest
                       "body", "list",
                       "listItem", "link", "text", "link_", "listItem_",
                       "listItem", "link", "text", "link_", "listItem_",
-                      "list_", "section1", "section2" );
+                      "list_", "text", "section1", "section2" );
     }
 }

Modified: 
maven/doxia/doxia/trunk/doxia-modules/doxia-module-markdown/src/test/resources/html-content.md
URL: 
http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-markdown/src/test/resources/html-content.md?rev=1788689&r1=1788688&r2=1788689&view=diff
==============================================================================
--- 
maven/doxia/doxia/trunk/doxia-modules/doxia-module-markdown/src/test/resources/html-content.md
 (original)
+++ 
maven/doxia/doxia/trunk/doxia-modules/doxia-module-markdown/src/test/resources/html-content.md
 Sat Mar 25 20:30:29 2017
@@ -1,7 +1,6 @@
 
 <div>
 <p><b>Example</b> is a <b>test</b> of mixing html and markdown
-
 </p>
 </div>
 
@@ -15,4 +14,4 @@ Some text
 <table>
 <tr><th>column</th></tr>
 <tr><td>data</td></tr>
-</table>
\ No newline at end of file
+</table>


Reply via email to