diff --git a/doxia-modules/doxia-module-markdown/src/main/java/org/apache/maven/doxia/module/markdown/MarkdownParser.java b/doxia-modules/doxia-module-markdown/src/main/java/org/apache/maven/doxia/module/markdown/MarkdownParser.java index a066c508c..b4fd58caa 100644 --- a/doxia-modules/doxia-module-markdown/src/main/java/org/apache/maven/doxia/module/markdown/MarkdownParser.java +++ b/doxia-modules/doxia-module-markdown/src/main/java/org/apache/maven/doxia/module/markdown/MarkdownParser.java @@ -189,6 +189,13 @@ CharSequence toHtml( Reader source ) html.append( "" ); html.append( "
" ); + // detect yaml style metadata + if ( text.startsWith( "---" ) ) + { + // remove the enclosing --- to get back to classical metadata + text = text.replaceFirst( "---", "" ).replaceFirst( "---", "" ); + } + // First, we interpret the "metadata" section of the document and add the corresponding HTML headers Matcher metadataMatcher = METADATA_SECTION_PATTERN.matcher( text ); boolean haveTitle = false; 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 11e4da53e..35b3799fa 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 @@ -300,7 +300,24 @@ public void testNumberedListSinkEvent() public void testMetadataSinkEvent() throws Exception { - List