Keep non-mdoc code block directives
guersam opened this issue · comments
Suppose that I want to add Docusaurus title to an mdoc code block like this:
```scala mdoc title="Main.scala"
object Main extends App {
// ...
}
```
Expected output
```scala title="Main.scala"
object Main extends App {
// ...
}
```
Actual output
```scala
object Main extends App {
// ...
}
```
Alternative case
In this case mdoc
directive is not recognized.
```scala title="Main.scala" mdoc
object Main extends Ap { // wrong but mdoc doesn't report error
// ...
}
```
Thanks for reporting! I can't work on it right now, but if anyone is willing I can try and help out.
@tgodzik I want to tackle this in my spare time. Could you give me some quick advice on where to look at?
The tag data should be kept in CodeFence
and it seems it's crated in that file. What I would do personally is add a test to:
https://github.com/scalameta/mdoc/blob/main/tests/unit/src/test/scala/tests/markdown/MultiModsSuite.scala
and print/debug what is going with that CodeFence and how are the additional modifiers being handled.
Tests can be run best with:
sbt
and then
~unit/testOnly tests.markdown.MultiModsSuite
to run the whole suite or ~unit/testOnly tests.markdown.MultiModsSuite -- *my-new-test-case
to run the added case. ~
will rerun the test on changes so it's super useful for quick debugging.