Repository navigation
Conversation
|
because we have our own metadata management code that already tricks Doxia API based on HTML-rendered Markdown: https://github.com/apache/maven-doxia/blob/master/doxia-modules/doxia-module-markdown/src/main/java/org/apache/maven/doxia/module/markdown/MarkdownParser.java#L188 then adding some other tricks at Markdown parsing level would conflict or duplicate |
|
I think this deserves a comment in the code why we aren't using the extension. |
|
@hboutemy Thank you for taking care of this! While "it works"(tm) as per the tests, the original intent was to remove as much as possible specific code to handle these headers and use the YAML Front Matter extension of Flexmark, which can handle complex data, like arrays, etc. You're right that even if we use Flexmark's extension, we still have to handle the
My opinion is still that using Flexmark is better in the long run, avoiding specific parsing (like handling empty lines or not, etc.) |
| date: 2013 © Copyleft | ||
| keywords: maven,doxia,markdown | ||
| --- | ||
|
|
There was a problem hiding this comment.
You will want to handle the case where there is no empty line after the metadata marker --- and add the corresponding unit test.
Example of Markdown file that must be supported:
---
title: Some news
date: 2022-12-29
---
Tesla: Stock Hits New Record Low
----------------------------------
Following Musk's decision to bla bla blaIn the above Markdown file, you need to make sure we don't end up with an extra <meta name="Tesla" content="Stock Hits New Record Low">
There was a problem hiding this comment.
yes, just test, you'll see that the current implementation doesn't have any problem with this example
|
if we use the parsing API for YAML form of metadata, it means we stop supporting metadata without the is it really what you all want? |
This would be one outcome, we discussed this breaking change with @bertysentry already. Regardless of this, do you see a lot of work making use of the extension in our code? |
|
@hboutemy This is a very good point. It's better to keep backward compatibility as long as it doesn't make our code too complex. In this case, we could use a simple replace regex to add the (ha ha, isn't the above regex charming? 🤦♂️) |
regex pr0n! |
|
Actually, the regexp should be: Using Java 8's Matcher we should be able to implement that mechanism (adding |
|
I don't get what benefit you get from this complex regexp to add the markers (+ new metadata management code) vs the simple marker removal code that keeps all existing code in place without needing to reimplement the whole metadata and title management: all the current PR is just 5 lines of basic code, that does not even require a regexp https://github.com/apache/maven-doxia/pull/132/files#diff-58b75a6a6d67dfd731133d8b93826810ccf10d33637b4305483ac8b6ffd320edR188 but don't hesitate to implement it |
|
@hboutemy Fair enough! It's easier to make random suggestions in a PR than actually implementing it. I'll try my own implementation, and if I get something with less code in total, I'll submit as a PR. |
|
Resolve #786 |
https://issues.apache.org/jira/browse/DOXIA-617
given the way metadata header are reworked during parsing by Doxia to detect title, I did not use Flexmark Yaml extension but coded detection and removal of the
---enclosing yaml metadataunit tests show that "it works! (TM)"