Closed EricGao888 closed 2 years ago
With the Gradle plugin, you can apply different formatters on different blocks (formatter inception).
But this only works if you have a regex that demarcates the nested HTML from the rest of the markdown. If all of the cases you care about fit with '<p ', '</p>'
then you could use this pattern to apply prettier or the Eclipse WTP formatter onto the embedded HTML. If that regex doens't capture all of the cases you care about, then you're probably better off improving the Flexmark project directly.
@nedtwigg Thanks for the reply. May I ask whether there is something similar to the formatter inception
in the Maven plugin?
There is not, but it might be possible. In the Gradle plugin, FormatExtension
is the receiver for adding generic steps. It has this method for defining a block, and then defining the steps within that block.
In the Maven plugin, the equivalents would be AbstractSpotlessMojo
and FormatterFactory
, but I'm not sure how to do a nested DSL in the maven plugin (or if that's even possible).
There is not, but it might be possible. In the Gradle plugin,
FormatExtension
is the receiver for adding generic steps. It has this method for defining a block, and then defining the steps within that block.In the Maven plugin, the equivalents would be
AbstractSpotlessMojo
andFormatterFactory
, but I'm not sure how to do a nested DSL in the maven plugin (or if that's even possible).
Got it, thanks!
Feel free to comment further if you need more help.
Sometimes we may have some
http
code inmarkdown
, e.g. image link like:Currently, markdown.FlexmarkStep in spotless could not fix
http
code formatting inmarkdown
. It would be pretty handy ifspotless
could support this feature in the future.BTW, I'd like to help with it but currently I haven't found a good way to implement this. Any help will be appreciated! Thx