openrewrite / rewrite-recipe-markdown-generator

Utility that generates OpenRewrite recipe documentation in markdown format for all recipes on the classpath.
Apache License 2.0
2 stars 7 forks source link

documentation generation broken for UpdateMavenWrapper #111

Closed Bananeweizen closed 2 months ago

Bananeweizen commented 2 months ago

What is the smallest, simplest way to reproduce the problem?

Look at https://docs.openrewrite.org/recipes/maven/updatemavenwrapper

The generated table is broken, except for the first line: grafik

Are you interested in contributing a fix to OpenRewrite?

I'm not aware how the documentation generation could be tested locally, so probably not.

timtebeek commented 2 months ago

Thanks for pointing this out @Bananeweizen ! Linking a few quick resources for context:

The wrapperDistribution option description here contains newlines: https://github.com/openrewrite/rewrite/blob/0324a3c60ac969bc00bce8b637021cb32248e82f/rewrite-maven/src/main/java/org/openrewrite/maven/UpdateMavenWrapper.java#L73-L84

This description is converted into a table cell in our recipe-markdown-generator: https://github.com/openrewrite/rewrite-recipe-markdown-generator/blob/50dac395a6af654ca8ab752700d39f06c51820f8/src/main/kotlin/org/openrewrite/RecipeMarkdownGenerator.kt#L814-L860

The markdown that generates is eventually pushed to https://github.com/openrewrite/rewrite-docs

timtebeek commented 2 months ago

In the above shown snippet we already have special handling for example values that contain newlines through .replace("\n", "<br />"). I think we could do the same here for option descriptions that contain newlines.

/cc @mike-solomon

mike-solomon commented 2 months ago

Fixed this in this commit - please note that the docs won't be fixed until the next time we generate them (should be in the next day or two). Thanks again for pointing this out!

timtebeek commented 2 months ago

Awesome, yes that works https://openrewrite.github.io/rewrite-recipe-markdown-generator/reference/recipes/maven/updatemavenwrapper.html