mdoc icon indicating copy to clipboard operation
mdoc copied to clipboard

Feature Request: Compiled inline code (single backtick)

Open swoogles opened this issue 3 years ago • 0 comments

Goal: If I have this in my markdown file

```scala mdoc
def badlyNamedFunction() = ???
```

Users should call `scala mdoc badlyNamedFunction`, then blah blah...

And later I rename badlyNamedFunction to perfectlyNamedFunction, then mdoc would error out and alert me that the function/val/class/etc was not found.

Since showing output would be impractical in all but the simplest cases, the default behavior would be mdoc:compile-only. It will protect our in-line code from the most egregious breakages, and not confuse paragraphs by trying to cram output in them. If you want to see output, use a stand-alone fence.

I think the most valuable modifiers are simply fail and warn.

Open Questions

  1. How do we smoothly handle "a pure expression does nothing" warnings? I expect they will be very common running the standard compiler against these fragments.
  2. Is the current scala mdoc prefix too verbose for this context? We could shorten it to just mdoc for example, since we don't need to provide the standard language header like we do in fences.

swoogles avatar Aug 12 '21 05:08 swoogles