JetBrains / markdown

Markdown parser written in kotlin
Apache License 2.0
706 stars 78 forks source link

Code Spans with ` are incorrectly trimmed #149

Closed Jolanrensen closed 7 months ago

Jolanrensen commented 8 months ago

Thanks to this line https://github.com/JetBrains/markdown/blob/aa54cceca5c28b694dcb7c940e910612c82fa76e/src/commonMain/kotlin/org/intellij/markdown/html/GeneratingProviders.kt#L73 Code spans like code span are trimmed when being rendered: image

I believe this is incorrect and code spans should retain all their content. This is also how Github renders their Gfm.

Jolanrensen commented 8 months ago

Looks like the tests that caught these were turned off by @ajalt in https://github.com/JetBrains/markdown/commit/49d1849d

Jolanrensen commented 8 months ago

Diving deeper, I think the issue was caused by https://github.com/JetBrains/markdown/commit/b44cfd1fa5172433a699c0b33ed454351d79d27c in https://github.com/JetBrains/markdown/pull/108 by @FirstTimeInForever.

I believe the TableAwareCodeSpanGeneratingProvider is used any time code spans are detected instead of just in tables.