You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2021/06/24 22:09:33 UTC

[maven-doxia] 01/01: [DOXIA-619] Sink.sectionTitle1() creates

instead of

This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch DOXIA-619
in repository https://gitbox.apache.org/repos/asf/maven-doxia.git

commit a55a8047b4412f9489b83d0333f3f5e7361e92f0
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Fri Jun 25 00:09:21 2021 +0200

    [DOXIA-619] Sink.sectionTitle1() creates <h2> instead of <h1>
---
 .../maven/doxia/parser/Xhtml5BaseParser.java       | 24 ++++++-------
 .../apache/maven/doxia/parser/XhtmlBaseParser.java | 22 ++++++------
 .../maven/doxia/sink/impl/Xhtml5BaseSink.java      | 24 ++++++-------
 .../maven/doxia/sink/impl/XhtmlBaseSink.java       | 24 ++++++-------
 .../apache/maven/doxia/macro/toc/TocMacroTest.java | 14 ++++----
 .../maven/doxia/parser/Xhtml5BaseParserTest.java   |  8 ++---
 .../maven/doxia/parser/XhtmlBaseParserTest.java    | 10 +++---
 .../maven/doxia/sink/impl/Xhtml5BaseSinkTest.java  | 14 ++++----
 .../maven/doxia/sink/impl/XhtmlBaseSinkTest.java   | 14 ++++----
 .../doxia/module/markdown/MarkdownParserTest.java  | 42 ++++++++++++----------
 .../src/test/resources/comment-before-heading.md   |  3 +-
 .../src/test/resources/macro-toc-DOXIA-559.md      |  2 +-
 .../src/test/resources/macro-toc.md                |  2 +-
 .../apache/maven/doxia/module/xdoc/XdocParser.java |  2 ++
 .../apache/maven/doxia/module/xdoc/XdocSink.java   | 12 +++----
 .../maven/doxia/module/xdoc/XdocParserTest.java    | 28 +++++++--------
 .../maven/doxia/module/xdoc/XdocSinkTest.java      |  6 ++--
 .../maven/doxia/module/xhtml/XhtmlSinkTest.java    | 12 +++----
 .../doxia-module-xhtml/src/test/resources/fun.html |  2 +-
 .../src/test/resources/index.xml.vm                | 22 ++++++------
 .../src/test/resources/test.xhtml                  | 10 +++---
 .../maven/doxia/module/xhtml5/Xhtml5Sink.java      | 24 ++++++-------
 .../maven/doxia/module/xhtml5/Xhtml5SinkTest.java  | 12 +++----
 .../src/test/resources/fun.html                    |  2 +-
 .../src/test/resources/index.xml.vm                | 16 ++++-----
 .../src/test/resources/test.xhtml                  | 10 +++---
 26 files changed, 183 insertions(+), 178 deletions(-)

diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/parser/Xhtml5BaseParser.java b/doxia-core/src/main/java/org/apache/maven/doxia/parser/Xhtml5BaseParser.java
index dd10f58..4884b17 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/parser/Xhtml5BaseParser.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/parser/Xhtml5BaseParser.java
@@ -122,8 +122,8 @@ public class Xhtml5BaseParser
      * </p>
      * <p>
      *   <code>
-     *      &lt;article&gt;, &lt;nav&gt;, &lt;aside&gt;, &lt;section&gt;, &lt;h2&gt;, &lt;h3&gt;, &lt;h4&gt;,
-     *      &lt;h5&gt;, &lt;h6&gt;, &lt;header&gt;, &lt;main&gt;, &lt;footer&gt;, &lt;em&gt;, &lt;strong&gt;,
+     *      &lt;article&gt;, &lt;nav&gt;, &lt;aside&gt;, &lt;section&gt;, &lt;h1&gt;, &lt;h2&gt;, &lt;h3&gt;,
+     *      &lt;h4&gt;, &lt;h5&gt;, &lt;header&gt;, &lt;main&gt;, &lt;footer&gt;, &lt;em&gt;, &lt;strong&gt;,
      *      &lt;small&gt;, &lt;s&gt;, &lt;cite&gt;, &lt;q&gt;, &lt;dfn&gt;, &lt;abbr&gt;, &lt;i&gt;,
      *      &lt;b&gt;, &lt;code&gt;, &lt;samp&gt;, &lt;kbd&gt;, &lt;sub&gt;, &lt;sup&gt;, &lt;u&gt;,
      *      &lt;mark&gt;, &lt;ruby&gt;, &lt;rb&gt;, &lt;rt&gt;, &lt;rtc&gt;, &lt;rp&gt;, &lt;bdi&gt;,
@@ -160,23 +160,23 @@ public class Xhtml5BaseParser
         {
             handleSectionStart( sink, attribs );
         }
-        else if ( parser.getName().equals( HtmlMarkup.H2.toString() ) )
+        else if ( parser.getName().equals( HtmlMarkup.H1.toString() ) )
         {
             handleHeadingStart( sink, Sink.SECTION_LEVEL_1, attribs );
         }
-        else if ( parser.getName().equals( HtmlMarkup.H3.toString() ) )
+        else if ( parser.getName().equals( HtmlMarkup.H2.toString() ) )
         {
             handleHeadingStart( sink, Sink.SECTION_LEVEL_2, attribs );
         }
-        else if ( parser.getName().equals( HtmlMarkup.H4.toString() ) )
+        else if ( parser.getName().equals( HtmlMarkup.H3.toString() ) )
         {
             handleHeadingStart( sink, Sink.SECTION_LEVEL_3, attribs );
         }
-        else if ( parser.getName().equals( HtmlMarkup.H5.toString() ) )
+        else if ( parser.getName().equals( HtmlMarkup.H4.toString() ) )
         {
             handleHeadingStart( sink, Sink.SECTION_LEVEL_4, attribs );
         }
-        else if ( parser.getName().equals( HtmlMarkup.H6.toString() ) )
+        else if ( parser.getName().equals( HtmlMarkup.H5.toString() ) )
         {
             handleHeadingStart( sink, Sink.SECTION_LEVEL_5, attribs );
         }
@@ -672,23 +672,23 @@ public class Xhtml5BaseParser
         {
             handleSectionEnd( sink );
         }
-        else if ( parser.getName().equals( HtmlMarkup.H2.toString() ) )
+        else if ( parser.getName().equals( HtmlMarkup.H1.toString() ) )
         {
             sink.sectionTitle1_();
         }
-        else if ( parser.getName().equals( HtmlMarkup.H3.toString() ) )
+        else if ( parser.getName().equals( HtmlMarkup.H2.toString() ) )
         {
             sink.sectionTitle2_();
         }
-        else if ( parser.getName().equals( HtmlMarkup.H4.toString() ) )
+        else if ( parser.getName().equals( HtmlMarkup.H3.toString() ) )
         {
             sink.sectionTitle3_();
         }
-        else if ( parser.getName().equals( HtmlMarkup.H5.toString() ) )
+        else if ( parser.getName().equals( HtmlMarkup.H4.toString() ) )
         {
             sink.sectionTitle4_();
         }
-        else if ( parser.getName().equals( HtmlMarkup.H6.toString() ) )
+        else if ( parser.getName().equals( HtmlMarkup.H5.toString() ) )
         {
             sink.sectionTitle5_();
         }
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/parser/XhtmlBaseParser.java b/doxia-core/src/main/java/org/apache/maven/doxia/parser/XhtmlBaseParser.java
index 411b045..6382251 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/parser/XhtmlBaseParser.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/parser/XhtmlBaseParser.java
@@ -389,7 +389,7 @@ public class XhtmlBaseParser
      * </p>
      * <p>
      *   <code>
-     *      &lt;h2&gt;, &lt;h3&gt;, &lt;h4&gt;, &lt;h5&gt;, &lt;h6&gt;, &lt;p&gt;, &lt;pre&gt;,
+     *      &lt;h1&gt;, &lt;h2&gt;, &lt;h3&gt;, &lt;h4&gt;, &lt;h5&gt;, &lt;p&gt;, &lt;pre&gt;,
      *      &lt;ul&gt;, &lt;ol&gt;, &lt;li&gt;, &lt;dl&gt;, &lt;dt&gt;, &lt;dd&gt;, &lt;b&gt;, &lt;strong&gt;,
      *      &lt;i&gt;, &lt;em&gt;, &lt;code&gt;, &lt;samp&gt;, &lt;tt&gt;, &lt;a&gt;, &lt;table&gt;, &lt;tr&gt;,
      *      &lt;th&gt;, &lt;td&gt;, &lt;caption&gt;, &lt;br/&gt;, &lt;hr/&gt;, &lt;img/&gt;.
@@ -406,23 +406,23 @@ public class XhtmlBaseParser
 
         SinkEventAttributeSet attribs = getAttributesFromParser( parser );
 
-        if ( parser.getName().equals( HtmlMarkup.H2.toString() ) )
+        if ( parser.getName().equals( HtmlMarkup.H1.toString() ) )
         {
             handleSectionStart( sink, Sink.SECTION_LEVEL_1, attribs );
         }
-        else if ( parser.getName().equals( HtmlMarkup.H3.toString() ) )
+        else if ( parser.getName().equals( HtmlMarkup.H2.toString() ) )
         {
             handleSectionStart( sink, Sink.SECTION_LEVEL_2, attribs );
         }
-        else if ( parser.getName().equals( HtmlMarkup.H4.toString() ) )
+        else if ( parser.getName().equals( HtmlMarkup.H3.toString() ) )
         {
             handleSectionStart( sink, Sink.SECTION_LEVEL_3, attribs );
         }
-        else if ( parser.getName().equals( HtmlMarkup.H5.toString() ) )
+        else if ( parser.getName().equals( HtmlMarkup.H4.toString() ) )
         {
             handleSectionStart( sink, Sink.SECTION_LEVEL_4, attribs );
         }
-        else if ( parser.getName().equals( HtmlMarkup.H6.toString() ) )
+        else if ( parser.getName().equals( HtmlMarkup.H5.toString() ) )
         {
             handleSectionStart( sink, Sink.SECTION_LEVEL_5, attribs );
         }
@@ -694,23 +694,23 @@ public class XhtmlBaseParser
         {
             sink.tableCaption_();
         }
-        else if ( parser.getName().equals( HtmlMarkup.H2.toString() ) )
+        else if ( parser.getName().equals( HtmlMarkup.H1.toString() ) )
         {
             sink.sectionTitle1_();
         }
-        else if ( parser.getName().equals( HtmlMarkup.H3.toString() ) )
+        else if ( parser.getName().equals( HtmlMarkup.H2.toString() ) )
         {
             sink.sectionTitle2_();
         }
-        else if ( parser.getName().equals( HtmlMarkup.H4.toString() ) )
+        else if ( parser.getName().equals( HtmlMarkup.H3.toString() ) )
         {
             sink.sectionTitle3_();
         }
-        else if ( parser.getName().equals( HtmlMarkup.H5.toString() ) )
+        else if ( parser.getName().equals( HtmlMarkup.H4.toString() ) )
         {
             sink.sectionTitle4_();
         }
-        else if ( parser.getName().equals( HtmlMarkup.H6.toString() ) )
+        else if ( parser.getName().equals( HtmlMarkup.H5.toString() ) )
         {
             sink.sectionTitle5_();
         }
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSink.java b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSink.java
index 45d726f..56b6286 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSink.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSink.java
@@ -568,11 +568,11 @@ public class Xhtml5BaseSink
      *
      * @param depth The level of the section title.
      * @param attributes some attributes. May be null.
+     * @see javax.swing.text.html.HTML.Tag#H1
      * @see javax.swing.text.html.HTML.Tag#H2
      * @see javax.swing.text.html.HTML.Tag#H3
      * @see javax.swing.text.html.HTML.Tag#H4
      * @see javax.swing.text.html.HTML.Tag#H5
-     * @see javax.swing.text.html.HTML.Tag#H6
      */
     protected void onSectionTitle( int depth, SinkEventAttributes attributes )
     {
@@ -581,23 +581,23 @@ public class Xhtml5BaseSink
 
         if ( depth == SECTION_LEVEL_1 )
         {
-            writeStartTag( HtmlMarkup.H2, atts );
+            writeStartTag( HtmlMarkup.H1, atts );
         }
         else if ( depth == SECTION_LEVEL_2 )
         {
-            writeStartTag( HtmlMarkup.H3, atts );
+            writeStartTag( HtmlMarkup.H2, atts );
         }
         else if ( depth == SECTION_LEVEL_3 )
         {
-            writeStartTag( HtmlMarkup.H4, atts );
+            writeStartTag( HtmlMarkup.H3, atts );
         }
         else if ( depth == SECTION_LEVEL_4 )
         {
-            writeStartTag( HtmlMarkup.H5, atts );
+            writeStartTag( HtmlMarkup.H4, atts );
         }
         else if ( depth == SECTION_LEVEL_5 )
         {
-            writeStartTag( HtmlMarkup.H6, atts );
+            writeStartTag( HtmlMarkup.H5, atts );
         }
     }
 
@@ -605,33 +605,33 @@ public class Xhtml5BaseSink
      * Ends a section title.
      *
      * @param depth The level of the section title.
+     * @see javax.swing.text.html.HTML.Tag#H1
      * @see javax.swing.text.html.HTML.Tag#H2
      * @see javax.swing.text.html.HTML.Tag#H3
      * @see javax.swing.text.html.HTML.Tag#H4
      * @see javax.swing.text.html.HTML.Tag#H5
-     * @see javax.swing.text.html.HTML.Tag#H6
      */
     protected void onSectionTitle_( int depth )
     {
         if ( depth == SECTION_LEVEL_1 )
         {
-            writeEndTag( HtmlMarkup.H2 );
+            writeEndTag( HtmlMarkup.H1 );
         }
         else if ( depth == SECTION_LEVEL_2 )
         {
-            writeEndTag( HtmlMarkup.H3 );
+            writeEndTag( HtmlMarkup.H2 );
         }
         else if ( depth == SECTION_LEVEL_3 )
         {
-            writeEndTag( HtmlMarkup.H4 );
+            writeEndTag( HtmlMarkup.H3 );
         }
         else if ( depth == SECTION_LEVEL_4 )
         {
-            writeEndTag( HtmlMarkup.H5 );
+            writeEndTag( HtmlMarkup.H4 );
         }
         else if ( depth == SECTION_LEVEL_5 )
         {
-            writeEndTag( HtmlMarkup.H6 );
+            writeEndTag( HtmlMarkup.H5 );
         }
     }
 
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/XhtmlBaseSink.java b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/XhtmlBaseSink.java
index 10d08ec..5a87986 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/XhtmlBaseSink.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/XhtmlBaseSink.java
@@ -514,11 +514,11 @@ public class XhtmlBaseSink
      *
      * @param depth The level of the section title.
      * @param attributes some attributes. May be null.
+     * @see javax.swing.text.html.HTML.Tag#H1
      * @see javax.swing.text.html.HTML.Tag#H2
      * @see javax.swing.text.html.HTML.Tag#H3
      * @see javax.swing.text.html.HTML.Tag#H4
      * @see javax.swing.text.html.HTML.Tag#H5
-     * @see javax.swing.text.html.HTML.Tag#H6
      */
     protected void onSectionTitle( int depth, SinkEventAttributes attributes )
     {
@@ -527,23 +527,23 @@ public class XhtmlBaseSink
 
         if ( depth == SECTION_LEVEL_1 )
         {
-            writeStartTag( HtmlMarkup.H2, atts );
+            writeStartTag( HtmlMarkup.H1, atts );
         }
         else if ( depth == SECTION_LEVEL_2 )
         {
-            writeStartTag( HtmlMarkup.H3, atts );
+            writeStartTag( HtmlMarkup.H2, atts );
         }
         else if ( depth == SECTION_LEVEL_3 )
         {
-            writeStartTag( HtmlMarkup.H4, atts );
+            writeStartTag( HtmlMarkup.H3, atts );
         }
         else if ( depth == SECTION_LEVEL_4 )
         {
-            writeStartTag( HtmlMarkup.H5, atts );
+            writeStartTag( HtmlMarkup.H4, atts );
         }
         else if ( depth == SECTION_LEVEL_5 )
         {
-            writeStartTag( HtmlMarkup.H6, atts );
+            writeStartTag( HtmlMarkup.H5, atts );
         }
     }
 
@@ -551,33 +551,33 @@ public class XhtmlBaseSink
      * Ends a section title.
      *
      * @param depth The level of the section title.
+     * @see javax.swing.text.html.HTML.Tag#H1
      * @see javax.swing.text.html.HTML.Tag#H2
      * @see javax.swing.text.html.HTML.Tag#H3
      * @see javax.swing.text.html.HTML.Tag#H4
      * @see javax.swing.text.html.HTML.Tag#H5
-     * @see javax.swing.text.html.HTML.Tag#H6
      */
     protected void onSectionTitle_( int depth )
     {
         if ( depth == SECTION_LEVEL_1 )
         {
-            writeEndTag( HtmlMarkup.H2 );
+            writeEndTag( HtmlMarkup.H1 );
         }
         else if ( depth == SECTION_LEVEL_2 )
         {
-            writeEndTag( HtmlMarkup.H3 );
+            writeEndTag( HtmlMarkup.H2 );
         }
         else if ( depth == SECTION_LEVEL_3 )
         {
-            writeEndTag( HtmlMarkup.H4 );
+            writeEndTag( HtmlMarkup.H3 );
         }
         else if ( depth == SECTION_LEVEL_4 )
         {
-            writeEndTag( HtmlMarkup.H5 );
+            writeEndTag( HtmlMarkup.H4 );
         }
         else if ( depth == SECTION_LEVEL_5 )
         {
-            writeEndTag( HtmlMarkup.H6 );
+            writeEndTag( HtmlMarkup.H5 );
         }
     }
 
diff --git a/doxia-core/src/test/java/org/apache/maven/doxia/macro/toc/TocMacroTest.java b/doxia-core/src/test/java/org/apache/maven/doxia/macro/toc/TocMacroTest.java
index d124f2f..cdd975e 100644
--- a/doxia-core/src/test/java/org/apache/maven/doxia/macro/toc/TocMacroTest.java
+++ b/doxia-core/src/test/java/org/apache/maven/doxia/macro/toc/TocMacroTest.java
@@ -53,7 +53,7 @@ public class TocMacroTest
     public void testExecute()
         throws MacroExecutionException
     {
-        String sourceContent = "<div><h2>h21</h2><h2>h22</h2><h3>h3</h3><h4>h4</h4><h2>h23</h2></div>";
+        String sourceContent = "<div><h1>h11</h1><h1>h12</h1><h2>h2</h2><h3>h3</h3><h1>h13</h1></div>";
 
         XhtmlBaseParser parser = new XhtmlBaseParser();
         parser.setSecondParsing( true );
@@ -129,14 +129,14 @@ public class TocMacroTest
         assertEquals( "link", ( it.next() ).getName() );
         event = it.next();
         assertEquals( "text", event.getName() );
-        assertEquals( "h22", event.getArgs()[0] );
+        assertEquals( "h12", event.getArgs()[0] );
         assertEquals( "link_", ( it.next() ).getName() );
         assertEquals( "list", ( it.next() ).getName() );
         assertEquals( "listItem", ( it.next() ).getName() );
         assertEquals( "link", ( it.next() ).getName() );
         event = it.next();
         assertEquals( "text", event.getName() );
-        assertEquals( "h3", event.getArgs()[0] );
+        assertEquals( "h2", event.getArgs()[0] );
         assertEquals( "link_", ( it.next() ).getName() );
         assertEquals( "listItem_", ( it.next() ).getName() );
         assertEquals( "list_", ( it.next() ).getName() );
@@ -155,7 +155,7 @@ public class TocMacroTest
         throws MacroExecutionException
     {
         String sourceContent =
-            "<div><h2>h<b>21</b></h2><h2>h<i>22</i></h2><h3>h<tt>3</tt></h3><h4>h4</h4><h2>h23</h2></div>";
+            "<div><h1>h<b>11</b></h1><h1>h<i>12</i></h1><h2>h<tt>2</tt></h2><h3>h3</h3><h1>h13</h1></div>";
 
         XhtmlBaseParser parser = new XhtmlBaseParser();
         parser.setSecondParsing( true );
@@ -173,8 +173,8 @@ public class TocMacroTest
         TocMacro macro = new TocMacro();
         macro.execute( sink, request );
 
-        assertTrue( out.toString().contains( "<a href=\"#h21\">h21</a>" ) );
-        assertTrue( out.toString().contains( "<a href=\"#h22\">h22</a>" ) );
-        assertTrue( out.toString().contains( "<a href=\"#h3\">h3</a>" ) );
+        assertTrue( out.toString().contains( "<a href=\"#h11\">h11</a>" ) );
+        assertTrue( out.toString().contains( "<a href=\"#h12\">h12</a>" ) );
+        assertTrue( out.toString().contains( "<a href=\"#h2\">h2</a>" ) );
     }
 }
diff --git a/doxia-core/src/test/java/org/apache/maven/doxia/parser/Xhtml5BaseParserTest.java b/doxia-core/src/test/java/org/apache/maven/doxia/parser/Xhtml5BaseParserTest.java
index 3d58d7a..df7e74f 100644
--- a/doxia-core/src/test/java/org/apache/maven/doxia/parser/Xhtml5BaseParserTest.java
+++ b/doxia-core/src/test/java/org/apache/maven/doxia/parser/Xhtml5BaseParserTest.java
@@ -72,7 +72,7 @@ public class Xhtml5BaseParserTest
     public void testHeadingEventsList()
         throws Exception
     {
-        String text = "<p><h2></h2><h3></h3><h4></h4><h5></h5><h6></h6><h2></h2></p>";
+        String text = "<p><h1></h1><h2></h2><h3></h3><h4></h4><h5></h5><h1></h1></p>";
 
         parser.parse( text, sink );
 
@@ -113,7 +113,7 @@ public class Xhtml5BaseParserTest
         throws Exception
     {
         // DOXIA-241
-        String text = "<p><h2></h2><h6></h6><h3></h3></p>";
+        String text = "<p><h1></h1><h5></h5><h2></h2></p>";
 
         parser.parse( text, sink );
 
@@ -364,7 +364,7 @@ public class Xhtml5BaseParserTest
         throws Exception
     {
         final String text = "<!DOCTYPE test [<!ENTITY flo \"&#x159;\"><!ENTITY tritPos \"&#x1d7ed;\"><!ENTITY fo \"&#65;\"><!ENTITY myCustom \"&fo;\">]>"
-                + "<body><h2>&amp;&flo;&#x159;&tritPos;&#x1d7ed;</h2><p>&amp;&flo;&#x159;&tritPos;&#x1d7ed;&myCustom;</p></body>";
+                + "<body><h1>&amp;&flo;&#x159;&tritPos;&#x1d7ed;</h1><p>&amp;&flo;&#x159;&tritPos;&#x1d7ed;&myCustom;</p></body>";
 
         parser.setValidate( false );
         parser.parse( text, sink );
@@ -431,7 +431,7 @@ public class Xhtml5BaseParserTest
     public void testXhtmlEntities()
         throws Exception
     {
-        final String text = "<body><h2>&quot;&amp;</h2><p>&apos;&lt;&gt;</p></body>";
+        final String text = "<body><h1>&quot;&amp;</h1><p>&apos;&lt;&gt;</p></body>";
 
         parser.parse( text, sink );
 
diff --git a/doxia-core/src/test/java/org/apache/maven/doxia/parser/XhtmlBaseParserTest.java b/doxia-core/src/test/java/org/apache/maven/doxia/parser/XhtmlBaseParserTest.java
index 58342db..9b3d8d5 100644
--- a/doxia-core/src/test/java/org/apache/maven/doxia/parser/XhtmlBaseParserTest.java
+++ b/doxia-core/src/test/java/org/apache/maven/doxia/parser/XhtmlBaseParserTest.java
@@ -76,7 +76,7 @@ public class XhtmlBaseParserTest
     public void testHeadingEventsList()
         throws Exception
     {
-        String text = "<p><h2></h2><h3></h3><h4></h4><h5></h5><h6></h6><h2></h2></p>";
+        String text = "<p><h1></h1><h2></h2><h3></h3><h4></h4><h5></h5><h1></h1></p>";
 
         parser.parse( text, sink );
 
@@ -118,7 +118,7 @@ public class XhtmlBaseParserTest
         throws Exception
     {
         // DOXIA-241
-        String text = "<p><h2></h2><h6></h6><h3></h3></p>";
+        String text = "<p><h1></h1><h5></h5><h2></h2></p>";
 
         parser.parse( text, sink );
 
@@ -376,7 +376,7 @@ public class XhtmlBaseParserTest
         throws Exception
     {
         final String text = "<!DOCTYPE test [<!ENTITY flo \"&#x159;\"><!ENTITY tritPos \"&#x1d7ed;\"><!ENTITY fo \"&#65;\"><!ENTITY myCustom \"&fo;\">]>"
-                + "<body><h2>&amp;&flo;&#x159;&tritPos;&#x1d7ed;</h2><p>&amp;&flo;&#x159;&tritPos;&#x1d7ed;&myCustom;</p></body>";
+                + "<body><h1>&amp;&flo;&#x159;&tritPos;&#x1d7ed;</h1><p>&amp;&flo;&#x159;&tritPos;&#x1d7ed;&myCustom;</p></body>";
 
         parser.setValidate( false );
         parser.parse( text, sink );
@@ -442,7 +442,7 @@ public class XhtmlBaseParserTest
     public void testXhtmlEntities()
         throws Exception
     {
-        final String text = "<body><h2>&laquo;&reg;</h2><p>&ldquo;&rsquo;&Phi;&larr;</p></body>";
+        final String text = "<body><h1>&laquo;&reg;</h1><p>&ldquo;&rsquo;&Phi;&larr;</p></body>";
 
         parser.parse( text, sink );
 
@@ -736,7 +736,7 @@ public class XhtmlBaseParserTest
         // ampersand should be un-escaped
         assertEquals( "http://ex.com/ex.jpg?v=l&l=e", attribs.getAttribute( "src" ) );
     }
-    
+
     public void testUnbalancedDefinitionListItem() throws Exception
     {
         String text = "<body><dl><dt>key</dt><dd>value</dd></dl>" +
diff --git a/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSinkTest.java b/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSinkTest.java
index 6e1652e..ed90fda 100644
--- a/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSinkTest.java
+++ b/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSinkTest.java
@@ -316,7 +316,7 @@ public class Xhtml5BaseSinkTest
             sink.close();
         }
 
-        assertEquals( "<section style=\"bold\">" + LS + "<h2 style=\"bold\"></h2></section>",
+        assertEquals( "<section style=\"bold\">" + LS + "<h1 style=\"bold\"></h1></section>",
                 writer.toString() );
     }
 
@@ -344,7 +344,7 @@ public class Xhtml5BaseSinkTest
             sink.close();
         }
 
-        assertEquals( "<section class=\"foo\" id=\"bar\">" + LS + "<h2></h2></section>", writer.toString() );
+        assertEquals( "<section class=\"foo\" id=\"bar\">" + LS + "<h1></h1></section>", writer.toString() );
     }
 
     /**
@@ -368,7 +368,7 @@ public class Xhtml5BaseSinkTest
             sink.close();
         }
 
-        assertEquals( "<section>" + LS + "<h2></h2></section>", writer.toString() );
+        assertEquals( "<section>" + LS + "<h1></h1></section>", writer.toString() );
     }
 
     /**
@@ -392,7 +392,7 @@ public class Xhtml5BaseSinkTest
             sink.close();
         }
 
-        assertEquals( "<section>" + LS + "<h3></h3></section>", writer.toString() );
+        assertEquals( "<section>" + LS + "<h2></h2></section>", writer.toString() );
     }
 
     /**
@@ -416,7 +416,7 @@ public class Xhtml5BaseSinkTest
             sink.close();
         }
 
-        assertEquals( "<section>" + LS + "<h4></h4></section>", writer.toString() );
+        assertEquals( "<section>" + LS + "<h3></h3></section>", writer.toString() );
     }
 
     /**
@@ -439,7 +439,7 @@ public class Xhtml5BaseSinkTest
             sink.close();
         }
 
-        assertEquals( "<section>" + LS + "<h5></h5></section>", writer.toString() );
+        assertEquals( "<section>" + LS + "<h4></h4></section>", writer.toString() );
     }
 
     /**
@@ -462,7 +462,7 @@ public class Xhtml5BaseSinkTest
             sink.close();
         }
 
-        assertEquals( "<section>" + LS + "<h6></h6></section>", writer.toString() );
+        assertEquals( "<section>" + LS + "<h5></h5></section>", writer.toString() );
     }
 
     /**
diff --git a/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/XhtmlBaseSinkTest.java b/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/XhtmlBaseSinkTest.java
index 9e498e2..7707ba4 100644
--- a/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/XhtmlBaseSinkTest.java
+++ b/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/XhtmlBaseSinkTest.java
@@ -205,7 +205,7 @@ public class XhtmlBaseSinkTest
             sink.close();
         }
 
-        assertEquals( "<div class=\"section\" style=\"bold\">" + LS + "<h2 style=\"bold\"></h2></div>",
+        assertEquals( "<div class=\"section\" style=\"bold\">" + LS + "<h1 style=\"bold\"></h1></div>",
                 writer.toString() );
     }
 
@@ -233,7 +233,7 @@ public class XhtmlBaseSinkTest
             sink.close();
         }
 
-        assertEquals( "<div class=\"foo\" id=\"bar\">" + LS + "<h2></h2></div>", writer.toString() );
+        assertEquals( "<div class=\"foo\" id=\"bar\">" + LS + "<h1></h1></div>", writer.toString() );
     }
 
     /**
@@ -257,7 +257,7 @@ public class XhtmlBaseSinkTest
             sink.close();
         }
 
-        assertEquals( "<div class=\"section\">" + LS + "<h2></h2></div>", writer.toString() );
+        assertEquals( "<div class=\"section\">" + LS + "<h1></h1></div>", writer.toString() );
     }
 
     /**
@@ -281,7 +281,7 @@ public class XhtmlBaseSinkTest
             sink.close();
         }
 
-        assertEquals( "<div class=\"section\">" + LS + "<h3></h3></div>", writer.toString() );
+        assertEquals( "<div class=\"section\">" + LS + "<h2></h2></div>", writer.toString() );
     }
 
     /**
@@ -305,7 +305,7 @@ public class XhtmlBaseSinkTest
             sink.close();
         }
 
-        assertEquals( "<div class=\"section\">" + LS + "<h4></h4></div>", writer.toString() );
+        assertEquals( "<div class=\"section\">" + LS + "<h3></h3></div>", writer.toString() );
     }
 
     /**
@@ -328,7 +328,7 @@ public class XhtmlBaseSinkTest
             sink.close();
         }
 
-        assertEquals( "<div class=\"section\">" + LS + "<h5></h5></div>", writer.toString() );
+        assertEquals( "<div class=\"section\">" + LS + "<h4></h4></div>", writer.toString() );
     }
 
     /**
@@ -351,7 +351,7 @@ public class XhtmlBaseSinkTest
             sink.close();
         }
 
-        assertEquals( "<div class=\"section\">" + LS + "<h6></h6></div>", writer.toString() );
+        assertEquals( "<div class=\"section\">" + LS + "<h5></h5></div>", writer.toString() );
     }
 
     /**
diff --git a/doxia-modules/doxia-module-markdown/src/test/java/org/apache/maven/doxia/module/markdown/MarkdownParserTest.java b/doxia-modules/doxia-module-markdown/src/test/java/org/apache/maven/doxia/module/markdown/MarkdownParserTest.java
index 11e4da5..221bee6 100644
--- a/doxia-modules/doxia-module-markdown/src/test/java/org/apache/maven/doxia/module/markdown/MarkdownParserTest.java
+++ b/doxia-modules/doxia-module-markdown/src/test/java/org/apache/maven/doxia/module/markdown/MarkdownParserTest.java
@@ -304,8 +304,9 @@ public class MarkdownParserTest
         Iterator<SinkEventElement> it = eventList.iterator();
 
         assertEquals( it, "head", "title", "text", "text", "text", "title_", "author", "text", "author_", "date", "text", "date_",
-                      "unknown", "head_", "body", "unknown", "text", "unknown", "paragraph", "text", "paragraph_", "section1",
-                      "sectionTitle1", "text", "sectionTitle1_", "paragraph", "text", "paragraph_", "section1_",
+                      "unknown", "head_", "body", "section1", "sectionTitle1", "text", "sectionTitle1_", "paragraph", "text",
+                      "paragraph_", "section2",
+                      "sectionTitle2", "text", "sectionTitle2_", "paragraph", "text", "paragraph_", "section2_", "section1_",
                       "body_" );
 
         assertFalse( it.hasNext() );
@@ -342,10 +343,9 @@ public class MarkdownParserTest
     {
         Iterator<SinkEventElement> it = parseFileToEventTestingSink( "first-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", "text",
-                "section1", "sectionTitle1", "text", "sectionTitle1_", "paragraph", "text",
-                "paragraph_", "section1_", "body_" );
+                "section1", "section2", "sectionTitle2", "text", "sectionTitle2_", "paragraph", "text",
+                "paragraph_", "section2_", "section1_", "body_" );
 
         assertFalse( it.hasNext() );
     }
@@ -360,9 +360,9 @@ 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", "text", "unknown", "text",
-                      "unknown", "paragraph", "text", "link", "text", "link_", "text", "paragraph_", "body_" );
+        assertEquals( it, "head", "title", "text", "title_", "head_", "body", "comment", "text","section1",
+                      "sectionTitle1", "text", "sectionTitle1_",
+                      "paragraph", "text", "paragraph_", "section1_", "body_" );
 
         assertFalse( it.hasNext() );
     }
@@ -377,13 +377,13 @@ public class MarkdownParserTest
     {
         Iterator<SinkEventElement> it = parseFileToEventTestingSink( "html-content" ).getEventList().iterator();
 
-        // NOTE: H1 and DIV are rendered as "unknown" and H2 is "section1" (see DOXIA-203)
         assertEquals( it, "head", "head_", "body", "unknown", "text", "paragraph", "inline", "text",
-                      "inline_", "text", "inline", "text", "inline_", "text", "paragraph_", "text", "unknown", "text", "horizontalRule", "unknown",
-                "text", "unknown", "paragraph", "text", "paragraph_", "text", "table", "tableRows", "text", "tableRow",
+                      "inline_", "text", "inline", "text", "inline_", "text", "paragraph_", "text", "unknown", "text",
+                      "horizontalRule", "section1", "sectionTitle1", "text", "sectionTitle1_",
+                "paragraph", "text", "paragraph_", "text", "table", "tableRows", "text", "tableRow",
                 "tableHeaderCell", "text", "tableHeaderCell_", "tableRow_", "text", "tableRow",
                                 "tableCell", "text", "tableCell_", "tableRow_", "text", "tableRows_", "table_",
-                "body_" );
+                "section1_", "body_" );
 
         assertFalse( it.hasNext() );
     }
@@ -433,8 +433,10 @@ public class MarkdownParserTest
                       "list_", // TOC end
                       "text",
                       "section1",
-                      "section2", "sectionTitle2", "text", "sectionTitle2_", "section2_",
-                      "section2", "sectionTitle2", "text", "sectionTitle2_", "section2_",
+                      "section2",
+                      "section3", "sectionTitle3", "text", "sectionTitle3_", "section3_",
+                      "section3", "sectionTitle3", "text", "sectionTitle3_", "section3_",
+                      "section2_",
                       "section1_",
                       "body_" );
     }
@@ -456,13 +458,15 @@ public class MarkdownParserTest
                       "listItem", "link", "text", "link_", "listItem_", // second section 2 TOC entry
                       "list_", // TOC end
                       "text",
-                      "section1", "sectionTitle1", "text", "sectionTitle1_",
-                      "section2",
-                      "section3", "sectionTitle3", "text", "sectionTitle3_",
+                      "section1",
+                      "section2", "sectionTitle2", "text", "sectionTitle2_",
+                      "section3",
+                      "section4", "sectionTitle4", "text", "sectionTitle4_",
+                      "section4_",
                       "section3_",
                       "section2_",
-                      "section1_",
-                      "section1", "sectionTitle1", "text", "sectionTitle1_",
+                      "section2", "sectionTitle2", "text", "sectionTitle2_",
+                      "section2_",
                       "section1_",
                       "body_" );
     }
diff --git a/doxia-modules/doxia-module-markdown/src/test/resources/comment-before-heading.md b/doxia-modules/doxia-module-markdown/src/test/resources/comment-before-heading.md
index bc17215..693a09e 100644
--- a/doxia-modules/doxia-module-markdown/src/test/resources/comment-before-heading.md
+++ b/doxia-modules/doxia-module-markdown/src/test/resources/comment-before-heading.md
@@ -21,5 +21,4 @@ Test document
 =============
 
 This document verifies that an initial HTML comment block does not prevent the first heading
-from being used as the document title. Currently the H1 headings are not rendered as sections by
-Doxia (see [DOXIA-203](http://jira.codehaus.org/browse/DOXIA-203)).
\ No newline at end of file
+from being used as the document title.
diff --git a/doxia-modules/doxia-module-markdown/src/test/resources/macro-toc-DOXIA-559.md b/doxia-modules/doxia-module-markdown/src/test/resources/macro-toc-DOXIA-559.md
index d508720..a9a2566 100644
--- a/doxia-modules/doxia-module-markdown/src/test/resources/macro-toc-DOXIA-559.md
+++ b/doxia-modules/doxia-module-markdown/src/test/resources/macro-toc-DOXIA-559.md
@@ -1,5 +1,5 @@
 
-<!-- MACRO{toc|fromDepth=1|toDepth=2} -->
+<!-- MACRO{toc|fromDepth=2|toDepth=3} -->
 
 ## level 2
 
diff --git a/doxia-modules/doxia-module-markdown/src/test/resources/macro-toc.md b/doxia-modules/doxia-module-markdown/src/test/resources/macro-toc.md
index 70e14c9..d04651b 100644
--- a/doxia-modules/doxia-module-markdown/src/test/resources/macro-toc.md
+++ b/doxia-modules/doxia-module-markdown/src/test/resources/macro-toc.md
@@ -1,5 +1,5 @@
 
-<!-- MACRO{toc|fromDepth=1|toDepth=2} -->
+<!-- MACRO{toc|fromDepth=2|toDepth=3} -->
 
 ### Subsection
 
diff --git a/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocParser.java b/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocParser.java
index e1b8184..d95a83a 100644
--- a/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocParser.java
+++ b/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocParser.java
@@ -306,6 +306,8 @@ public class XdocParser
         else if ( parser.getName().equals( SUBSECTION_TAG.toString() ) )
         {
             consecutiveSections( Sink.SECTION_LEVEL_1, sink );
+
+            // sink.section2_() not necessary
         }
         else if ( !baseEndTag( parser, sink ) )
         {
diff --git a/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java b/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java
index 3c8f334..ffaaae7 100644
--- a/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java
+++ b/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java
@@ -338,15 +338,15 @@ public class XdocSink
 
         if ( depth == SECTION_LEVEL_3 )
         {
-            writeStartTag( H4, atts );
+            writeStartTag( H3, atts );
         }
         else if ( depth == SECTION_LEVEL_4 )
         {
-            writeStartTag( H5, atts );
+            writeStartTag( H4, atts );
         }
         else if ( depth == SECTION_LEVEL_5 )
         {
-            writeStartTag( H6, atts );
+            writeStartTag( H5, atts );
         }
     }
 
@@ -366,15 +366,15 @@ public class XdocSink
         }
         else if ( depth == SECTION_LEVEL_3 )
         {
-            writeEndTag( H4 );
+            writeEndTag( H3 );
         }
         else if ( depth == SECTION_LEVEL_4 )
         {
-            writeEndTag( H5 );
+            writeEndTag( H4 );
         }
         else if ( depth == SECTION_LEVEL_5 )
         {
-            writeEndTag( H6 );
+            writeEndTag( H5 );
         }
     }
 
diff --git a/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocParserTest.java b/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocParserTest.java
index a7fd9b8..84a26a6 100644
--- a/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocParserTest.java
+++ b/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocParserTest.java
@@ -249,7 +249,7 @@ public class XdocParserTest
         throws Exception
     {
         // DOXIA-241
-        String text = "<section name=\"section\"><h6>h6</h6><subsection name=\"subsection\"></subsection></section>";
+        String text = "<section name=\"section\"><h5>h5</h5><subsection name=\"subsection\"></subsection></section>";
 
         Iterator<SinkEventElement> it = parseText( text );
 
@@ -405,31 +405,31 @@ public class XdocParserTest
 
         assertEquals( it, "paragraph_", "section1_" );
     }
-    
+
     public void testStyleWithCData() throws Exception
     {
         // DOXIA-449
-        final String text = "<style type=\"text/css\">\n" + 
-        		"<![CDATA[\n" + 
-        		"h2 {\n" + 
-        		"font-size: 50px;\n" + 
-        		"}\n" + 
-        		"]]>\n" + 
-        		"</style>"; 
-        
+        final String text = "<style type=\"text/css\">\n" +
+                "<![CDATA[\n" +
+                "h2 {\n" +
+                "font-size: 50px;\n" +
+                "}\n" +
+                "]]>\n" +
+                "</style>";
+
         SinkEventTestingSink sink = new SinkEventTestingSink();
 
         parser.setValidate( false );
         parser.parse( text, sink );
-        
+
         Iterator<SinkEventElement> it = sink.getEventList().iterator();
-        SinkEventElement styleElm = it.next(); 
+        SinkEventElement styleElm = it.next();
         assertEquals( "unknown", styleElm.getName() );
         assertEquals( "style", styleElm.getArgs()[0] );
-        SinkEventElement cdataElm = it.next(); 
+        SinkEventElement cdataElm = it.next();
         assertEquals( "unknown", cdataElm.getName() );
         assertEquals( "CDATA", cdataElm.getArgs()[0] );
-        SinkEventElement styleElm_ = it.next(); 
+        SinkEventElement styleElm_ = it.next();
         assertEquals( "unknown", styleElm_.getName() );
         assertEquals( "style", styleElm_.getArgs()[0] );
         assertFalse( it.hasNext() );
diff --git a/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocSinkTest.java b/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocSinkTest.java
index f1d21b7..1f3670b 100644
--- a/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocSinkTest.java
+++ b/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocSinkTest.java
@@ -126,19 +126,19 @@ public class XdocSinkTest
     /** {@inheritDoc} */
     protected String getSection3Block( String title )
     {
-        return "<h4>" + title + "</h4>";
+        return "<h3>" + title + "</h3>";
     }
 
     /** {@inheritDoc} */
     protected String getSection4Block( String title )
     {
-        return "<h5>" + title + "</h5>";
+        return "<h4>" + title + "</h4>";
     }
 
     /** {@inheritDoc} */
     protected String getSection5Block( String title )
     {
-        return "<h6>" + title + "</h6>";
+        return "<h5>" + title + "</h5>";
     }
 
     /** {@inheritDoc} */
diff --git a/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlSinkTest.java b/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlSinkTest.java
index 2ed78ff..3771a4f 100644
--- a/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlSinkTest.java
+++ b/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlSinkTest.java
@@ -147,31 +147,31 @@ public class XhtmlSinkTest
     /** {@inheritDoc} */
     protected String getSection1Block( String title )
     {
-        return "<div class=\"section\">\n<h2>" + title + "</h2></div>";
+        return "<div class=\"section\">\n<h1>" + title + "</h1></div>";
     }
 
     /** {@inheritDoc} */
     protected String getSection2Block( String title )
     {
-        return "<div class=\"section\">\n<h3>" + title + "</h3></div>";
+        return "<div class=\"section\">\n<h2>" + title + "</h2></div>";
     }
 
     /** {@inheritDoc} */
     protected String getSection3Block( String title )
     {
-        return "<div class=\"section\">\n<h4>" + title + "</h4></div>";
+        return "<div class=\"section\">\n<h3>" + title + "</h3></div>";
     }
 
     /** {@inheritDoc} */
     protected String getSection4Block( String title )
     {
-        return "<div class=\"section\">\n<h5>" + title + "</h5></div>";
+        return "<div class=\"section\">\n<h4>" + title + "</h4></div>";
     }
 
     /** {@inheritDoc} */
     protected String getSection5Block( String title )
     {
-        return "<div class=\"section\">\n<h6>" + title + "</h6></div>";
+        return "<div class=\"section\">\n<h5>" + title + "</h5></div>";
     }
 
     /** {@inheritDoc} */
@@ -406,7 +406,7 @@ public class XhtmlSinkTest
             sink.close();
         }
 
-        assertEquals( "<div class=\"section\">\n<h2>&amp;</h2>\n<p>&amp;</p></div>", writer.toString() );
+        assertEquals( "<div class=\"section\">\n<h1>&amp;</h1>\n<p>&amp;</p></div>", writer.toString() );
     }
 
     /**
diff --git a/doxia-modules/doxia-module-xhtml/src/test/resources/fun.html b/doxia-modules/doxia-module-xhtml/src/test/resources/fun.html
index d8f2cd3..fdb3232 100644
--- a/doxia-modules/doxia-module-xhtml/src/test/resources/fun.html
+++ b/doxia-modules/doxia-module-xhtml/src/test/resources/fun.html
@@ -34,7 +34,7 @@ under the License.
 	    <p>
 	    	This paragraph belongs to subsection two.
 	    </p>
-	    	<h4>This is the first third-level section</h4>
+	    	<h3>This is the first third-level section</h3>
 	    	<p>
 	    		To make the <em>task</em> <i>even</i> harder,
 	    		the <tt>h3</tt>-heading was dropped, but we
diff --git a/doxia-modules/doxia-module-xhtml/src/test/resources/index.xml.vm b/doxia-modules/doxia-module-xhtml/src/test/resources/index.xml.vm
index 96d7597..f6c942b 100644
--- a/doxia-modules/doxia-module-xhtml/src/test/resources/index.xml.vm
+++ b/doxia-modules/doxia-module-xhtml/src/test/resources/index.xml.vm
@@ -29,7 +29,7 @@ under the License.
 
     <!-- TODO: news? -->
     <div id="downloadbox">
-    <h5>Search Maven Sites</h5>
+    <h4>Search Maven Sites</h4>
 <!-- Google CSE Search Box Begins  -->
 <form action="http://www.google.com/cse" id="searchbox_006660305041243700248:hyqtfwsewpm">
   <input type="hidden" name="cx" value="006660305041243700248:hyqtfwsewpm" />
@@ -39,7 +39,7 @@ under the License.
 <script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=searchbox_006660305041243700248%3Ahyqtfwsewpm"></script>
 <!-- Google CSE Search Box Ends -->
 
-	<h5>Get Maven ${currentVersion}</h5>
+	<h4>Get Maven ${currentVersion}</h4>
       <span style="display: block; text-align: right; font-size: smaller">Released: 20 June 2007</span>
       <p>
         <a href="download.html">
@@ -68,7 +68,7 @@ under the License.
       </p>
       <!-- TODO: what about downloads for Continuum, etc.? Would be good to have one big download page -->
 
-      <h5>Other Maven Projects</h5>
+      <h4>Other Maven Projects</h4>
       <p>
         <a href="/continuum/">
           <img src="images/continuum.png" border="0" width="76" height="32" style="float: left; margin-right: 1em;" alt="" title="Continuum" />
@@ -77,16 +77,16 @@ under the License.
         continuous integration server
       </p>
       <!--
-      
+
       You can't be promoting Archiva when it's never been released, it's completely alpha and this is misleading.
       When it's released I think it can rightfully be put here.
-      
+
       <p>
         <a href="archiva">
           <img src="images/archiva.png" border="0" width="76" height="32" style="float: left; margin-right: 1em;" alt="" title="Archiva" />
         Archiva
         </a>
-        repository and artifact management server 
+        repository and artifact management server
       </p>
       -->
       <p>
@@ -118,7 +118,7 @@ width="244" height="68"></iframe>
         a <a href="maven-features.html">list of some of its main features</a>, and a set of <a href="general.html">frequently
         asked questions about what Maven is</a>.
       </p>
-      <h3>Learning about Maven</h3>
+      <h2>Learning about Maven</h2>
       <p>
         <!-- TODO: this could be the big button type thing instead of a list of links -->
         This site is separated into the following sections, depending on how you'd like to use Maven:
@@ -177,7 +177,7 @@ width="244" height="68"></iframe>
       <p>
         You can access the guides at any time from the left navigation.
       </p>
-      <h3>Documentation Index</h3>
+      <h2>Documentation Index</h2>
       <p>
         If you are looking for a quick reference, you can use the <a href="guides/index.html">documentation index.</a>
 <!-- TODO
@@ -185,7 +185,7 @@ width="244" height="68"></iframe>
         <a href="todo.html">alphabetical</a> and <a href="todo.html">categorical</a> listing formats.
 -->
       </p>
-      <h3>Plugins</h3>
+      <h2>Plugins</h2>
 <!-- TODO
       <p>
         Maven functionality is provided by plugins. For an explanation of how plugins work, and basic information on how
@@ -197,7 +197,7 @@ width="244" height="68"></iframe>
         <a href="plugins/index.html">plugin list</a>.
       </p>
 <!-- TODO: Should these be here, or just in the user centre?
-      <h3>Converting from a different Build System</h3>
+      <h2>Converting from a different Build System</h2>
       <p>
         If you are currently using a different build system, there are options for converting from that to Maven 2
         either partially or completely. These guides also give an overview of the differences between Maven and the
@@ -209,7 +209,7 @@ width="244" height="68"></iframe>
         <li><a href="todo.html">Adding Maven 2 to an IDE based build</a></li>
       </ul>
 -->
-      <h3>How to Get Support</h3>
+      <h2>How to Get Support</h2>
       <p>
         Support for Maven is available in a variety of different forms.
       </p>
diff --git a/doxia-modules/doxia-module-xhtml/src/test/resources/test.xhtml b/doxia-modules/doxia-module-xhtml/src/test/resources/test.xhtml
index f9d07c3..fd94454 100644
--- a/doxia-modules/doxia-module-xhtml/src/test/resources/test.xhtml
+++ b/doxia-modules/doxia-module-xhtml/src/test/resources/test.xhtml
@@ -34,11 +34,11 @@ under the License.
 <p>Paragraph 1, line 1. Paragraph 1, line 2.</p>
 <p>Paragraph 2, line 1. Paragraph 2, line 2.</p>
 
-<div class="section"><h2>Section title</h2>
-<div class="section"><h3>Sub-section title</h3>
-<div class="section"><h4>Sub-sub-section title</h4>
-<div class="section"><h5>Sub-sub-sub-section title</h5>
-<div class="section"><h6>Sub-sub-sub-sub-section title</h6>
+<div class="section"><h1>Section title</h1>
+<div class="section"><h2>Sub-section title</h2>
+<div class="section"><h3>Sub-sub-section title</h3>
+<div class="section"><h4>Sub-sub-sub-section title</h4>
+<div class="section"><h5>Sub-sub-sub-sub-section title</h5>
 
 <ul>
   <li>List item 1.</li>
diff --git a/doxia-modules/doxia-module-xhtml5/src/main/java/org/apache/maven/doxia/module/xhtml5/Xhtml5Sink.java b/doxia-modules/doxia-module-xhtml5/src/main/java/org/apache/maven/doxia/module/xhtml5/Xhtml5Sink.java
index 1178317..8c570bf 100644
--- a/doxia-modules/doxia-module-xhtml5/src/main/java/org/apache/maven/doxia/module/xhtml5/Xhtml5Sink.java
+++ b/doxia-modules/doxia-module-xhtml5/src/main/java/org/apache/maven/doxia/module/xhtml5/Xhtml5Sink.java
@@ -279,11 +279,11 @@ public class Xhtml5Sink
      * {@inheritDoc}
      *
      * Starts a section title.
+     * @see javax.swing.text.html.HTML.Tag#H1
      * @see javax.swing.text.html.HTML.Tag#H2
      * @see javax.swing.text.html.HTML.Tag#H3
      * @see javax.swing.text.html.HTML.Tag#H4
      * @see javax.swing.text.html.HTML.Tag#H5
-     * @see javax.swing.text.html.HTML.Tag#H6
      */
     protected void onSectionTitle( int depth, SinkEventAttributes attributes )
     {
@@ -292,23 +292,23 @@ public class Xhtml5Sink
 
         if ( depth == SECTION_LEVEL_1 )
         {
-            writeStartTag( HtmlMarkup.H2, atts );
+            writeStartTag( HtmlMarkup.H1, atts );
         }
         else if ( depth == SECTION_LEVEL_2 )
         {
-            writeStartTag( HtmlMarkup.H3, atts );
+            writeStartTag( HtmlMarkup.H2, atts );
         }
         else if ( depth == SECTION_LEVEL_3 )
         {
-            writeStartTag( HtmlMarkup.H4, atts );
+            writeStartTag( HtmlMarkup.H3, atts );
         }
         else if ( depth == SECTION_LEVEL_4 )
         {
-            writeStartTag( HtmlMarkup.H5, atts );
+            writeStartTag( HtmlMarkup.H4, atts );
         }
         else if ( depth == SECTION_LEVEL_5 )
         {
-            writeStartTag( HtmlMarkup.H6, atts );
+            writeStartTag( HtmlMarkup.H5, atts );
         }
     }
 
@@ -316,33 +316,33 @@ public class Xhtml5Sink
      * {@inheritDoc}
      *
      * Ends a section title.
+     * @see javax.swing.text.html.HTML.Tag#H1
      * @see javax.swing.text.html.HTML.Tag#H2
      * @see javax.swing.text.html.HTML.Tag#H3
      * @see javax.swing.text.html.HTML.Tag#H4
      * @see javax.swing.text.html.HTML.Tag#H5
-     * @see javax.swing.text.html.HTML.Tag#H6
      */
     protected void onSectionTitle_( int depth )
     {
         if ( depth == SECTION_LEVEL_1 )
         {
-            writeEndTag( HtmlMarkup.H2 );
+            writeEndTag( HtmlMarkup.H1 );
         }
         else if ( depth == SECTION_LEVEL_2 )
         {
-            writeEndTag( HtmlMarkup.H3 );
+            writeEndTag( HtmlMarkup.H2 );
         }
         else if ( depth == SECTION_LEVEL_3 )
         {
-            writeEndTag( HtmlMarkup.H4 );
+            writeEndTag( HtmlMarkup.H3 );
         }
         else if ( depth == SECTION_LEVEL_4 )
         {
-            writeEndTag( HtmlMarkup.H5 );
+            writeEndTag( HtmlMarkup.H4 );
         }
         else if ( depth == SECTION_LEVEL_5 )
         {
-            writeEndTag( HtmlMarkup.H6 );
+            writeEndTag( HtmlMarkup.H5 );
         }
     }
 
diff --git a/doxia-modules/doxia-module-xhtml5/src/test/java/org/apache/maven/doxia/module/xhtml5/Xhtml5SinkTest.java b/doxia-modules/doxia-module-xhtml5/src/test/java/org/apache/maven/doxia/module/xhtml5/Xhtml5SinkTest.java
index 36e0271..3cc69c8 100644
--- a/doxia-modules/doxia-module-xhtml5/src/test/java/org/apache/maven/doxia/module/xhtml5/Xhtml5SinkTest.java
+++ b/doxia-modules/doxia-module-xhtml5/src/test/java/org/apache/maven/doxia/module/xhtml5/Xhtml5SinkTest.java
@@ -144,31 +144,31 @@ public class Xhtml5SinkTest
     /** {@inheritDoc} */
     protected String getSection1Block( String title )
     {
-        return "<section><header>\n<h2>" + title + "</h2></header></section>";
+        return "<section><header>\n<h1>" + title + "</h1></header></section>";
     }
 
     /** {@inheritDoc} */
     protected String getSection2Block( String title )
     {
-        return "<section><header>\n<h3>" + title + "</h3></header></section>";
+        return "<section><header>\n<h2>" + title + "</h2></header></section>";
     }
 
     /** {@inheritDoc} */
     protected String getSection3Block( String title )
     {
-        return "<section><header>\n<h4>" + title + "</h4></header></section>";
+        return "<section><header>\n<h3>" + title + "</h3></header></section>";
     }
 
     /** {@inheritDoc} */
     protected String getSection4Block( String title )
     {
-        return "<section><header>\n<h5>" + title + "</h5></header></section>";
+        return "<section><header>\n<h4>" + title + "</h4></header></section>";
     }
 
     /** {@inheritDoc} */
     protected String getSection5Block( String title )
     {
-        return "<section><header>\n<h6>" + title + "</h6></header></section>";
+        return "<section><header>\n<h5>" + title + "</h5></header></section>";
     }
 
     /** {@inheritDoc} */
@@ -401,7 +401,7 @@ public class Xhtml5SinkTest
             sink.close();
         }
 
-        assertEquals( "<section><header>\n<h2>&amp;</h2></header>\n<p>&amp;</p></section>", writer.toString() );
+        assertEquals( "<section><header>\n<h1>&amp;</h1></header>\n<p>&amp;</p></section>", writer.toString() );
     }
 
     /**
diff --git a/doxia-modules/doxia-module-xhtml5/src/test/resources/fun.html b/doxia-modules/doxia-module-xhtml5/src/test/resources/fun.html
index 059aca5..e0fdf93 100644
--- a/doxia-modules/doxia-module-xhtml5/src/test/resources/fun.html
+++ b/doxia-modules/doxia-module-xhtml5/src/test/resources/fun.html
@@ -34,7 +34,7 @@ under the License.
         <p>
             This paragraph belongs to subsection two.
         </p>
-            <h4>This is the first third-level section</h4>
+            <h3>This is the first third-level section</h3>
             <p>
                 To make the <em>task</em> <i>even</i> harder,
                 the <tt>h3</tt>-heading was dropped, but we
diff --git a/doxia-modules/doxia-module-xhtml5/src/test/resources/index.xml.vm b/doxia-modules/doxia-module-xhtml5/src/test/resources/index.xml.vm
index 0050c11..4c56c01 100644
--- a/doxia-modules/doxia-module-xhtml5/src/test/resources/index.xml.vm
+++ b/doxia-modules/doxia-module-xhtml5/src/test/resources/index.xml.vm
@@ -29,7 +29,7 @@ under the License.
 
     <!-- TODO: news? -->
     <div id="downloadbox">
-    <h5>Search Maven Sites</h5>
+    <h4>Search Maven Sites</h4>
 <!-- Google CSE Search Box Begins  -->
 <form action="http://www.google.com/cse" id="searchbox_006660305041243700248:hyqtfwsewpm">
   <input type="hidden" name="cx" value="006660305041243700248:hyqtfwsewpm" />
@@ -39,7 +39,7 @@ under the License.
 <script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=searchbox_006660305041243700248%3Ahyqtfwsewpm"></script>
 <!-- Google CSE Search Box Ends -->
 
-    <h5>Get Maven ${currentVersion}</h5>
+    <h4>Get Maven ${currentVersion}</h4>
       <span style="display: block; text-align: right; font-size: smaller">Released: 20 June 2007</span>
       <p>
         <a href="download.html">
@@ -68,7 +68,7 @@ under the License.
       </p>
       <!-- TODO: what about downloads for Continuum, etc.? Would be good to have one big download page -->
 
-      <h5>Other Maven Projects</h5>
+      <h4>Other Maven Projects</h4>
       <p>
         <a href="/continuum/">
           <img src="images/continuum.png" border="0" width="76" height="32" style="float: left; margin-right: 1em;" alt="" title="Continuum" />
@@ -118,7 +118,7 @@ width="244" height="68"></iframe>
         a <a href="maven-features.html">list of some of its main features</a>, and a set of <a href="general.html">frequently
         asked questions about what Maven is</a>.
       </p>
-      <h3>Learning about Maven</h3>
+      <h2>Learning about Maven</h2>
       <p>
         <!-- TODO: this could be the big button type thing instead of a list of links -->
         This site is separated into the following sections, depending on how you'd like to use Maven:
@@ -177,7 +177,7 @@ width="244" height="68"></iframe>
       <p>
         You can access the guides at any time from the left navigation.
       </p>
-      <h3>Documentation Index</h3>
+      <h2>Documentation Index</h2>
       <p>
         If you are looking for a quick reference, you can use the <a href="guides/index.html">documentation index.</a>
 <!-- TODO
@@ -185,7 +185,7 @@ width="244" height="68"></iframe>
         <a href="todo.html">alphabetical</a> and <a href="todo.html">categorical</a> listing formats.
 -->
       </p>
-      <h3>Plugins</h3>
+      <h2>Plugins</h2>
 <!-- TODO
       <p>
         Maven functionality is provided by plugins. For an explanation of how plugins work, and basic information on how
@@ -197,7 +197,7 @@ width="244" height="68"></iframe>
         <a href="plugins/index.html">plugin list</a>.
       </p>
 <!-- TODO: Should these be here, or just in the user centre?
-      <h3>Converting from a different Build System</h3>
+      <h2>Converting from a different Build System</h2>
       <p>
         If you are currently using a different build system, there are options for converting from that to Maven 2
         either partially or completely. These guides also give an overview of the differences between Maven and the
@@ -209,7 +209,7 @@ width="244" height="68"></iframe>
         <li><a href="todo.html">Adding Maven 2 to an IDE based build</a></li>
       </ul>
 -->
-      <h3>How to Get Support</h3>
+      <h2>How to Get Support</h2>
       <p>
         Support for Maven is available in a variety of different forms.
       </p>
diff --git a/doxia-modules/doxia-module-xhtml5/src/test/resources/test.xhtml b/doxia-modules/doxia-module-xhtml5/src/test/resources/test.xhtml
index e7392e5..5e4fa81 100644
--- a/doxia-modules/doxia-module-xhtml5/src/test/resources/test.xhtml
+++ b/doxia-modules/doxia-module-xhtml5/src/test/resources/test.xhtml
@@ -34,11 +34,11 @@ under the License.
 <p>Paragraph 1, line 1. Paragraph 1, line 2.</p>
 <p>Paragraph 2, line 1. Paragraph 2, line 2.</p>
 
-<section><h2>Section title</h2>
-<section><h3>Sub-section title</h3>
-<section><h4>Sub-sub-section title</h4>
-<section><h5>Sub-sub-sub-section title</h5>
-<section><h6>Sub-sub-sub-sub-section title</h6>
+<section><h1>Section title</h1>
+<section><h2>Sub-section title</h2>
+<section><h3>Sub-sub-section title</h3>
+<section><h4>Sub-sub-sub-section title</h4>
+<section><h5>Sub-sub-sub-sub-section title</h5>
 
 <ul>
   <li>List item 1.</li>