Skip to content

It is not possible to to use samples of <embed-code> in the documentation #26

@alexander-yevsyukov

Description

@alexander-yevsyukov

I wanted to document using <embed-code> XML for embedding the documentation in my Markdown document. Here's the code I have in my .md file:

````markdown
<embed-code
  file="$root/version.gradle.kts"
  start="val validationVersion"
  end="val validationVersion">
</embed-code>
```kotlin
val validationVersion by extra("2.0.0-SNAPSHOT.419")
```
````

Checking samples fails with the following console output:

> Task :docs:checkSamples
Using user's local bash profile.
export plugin already enabled
Running locally on macOS.
Running embed-code v1.1.0.
Panic: runtime error: index out of range [-1]

Codex tells me that the nature of the error is this:

New docs break the embed-code check. embedded-examples.md (line 126) and procedures.md (line 124) include literal examples that the checker scans as real embed directives. ./gradlew :docs:checkSamples fails with Panic: runtime error: index out of range [-1]. The procedures.md text also says to add an empty fenced block, but the example omits it. I’d either avoid literal tags in examples, or use a four-backtick outer Markdown fence and include a real inner fenced block after the directive.

Workaround

As a fallback for <embed-code> samples I replaced the dash in embed-code with the n-dash. It looks almost the same, but fools the tool around the XML.

Metadata

Metadata

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions