Skip to content

Feature Request: Compiled inline code (single backtick) #544

@swoogles

Description

@swoogles

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions