Skip to content

Ability to reference production code via a relative path #9

@alexander-yevsyukov

Description

@alexander-yevsyukov

I am trying to reference a file outside of the specified root of the examples code. It almost works, so I don't know if it's a bug or a feature request. Let me explain in details.

I'm writing a next round of the documentation for the Validation library. Here's the PR.

My embed-code.yml is configured like this:

code-path: "../_examples"
docs-path: "../content/docs/"
embed-mappings:
  - code-path: "../_examples"
    docs-path: "../content/docs/"

The _examples directory lives as a Git submodule under the docs subfolder under the root of the project called validation. So the structure looks like this:

validation
  docs         # The documentation submodule.
    _bin       # This is where `embed-code` binaries live.
    _examples
    content
  jvm-runtime.  # The production code directory I want to reference.

Here's how I try to reference the file I need using the embed-code tag:

<embed-code file="../../../../jvm-runtime/src/main/kotlin/io/spine/validation/TimestampValidator.kt" fragment="core"></embed-code>

For that I got the following error:

panic: embedding error for file ``: unable to embed construction for doc file `../content/docs/validation/04-third-party-messages/_index.md` at line 109: unable to read the code fence end: file /Users/sanders/Projects/Spine/validation/jvm-runtime/src/main/kotlin/io/spine/validation/TimestampValidator-4358f8ba.kt doesn't exist.

Notice the following directory referenced in the error:

/Users/sanders/Projects/Spine/validation/jvm-runtime/src/main/kotlin/io/spine/validation/

This is the correct directory on my file system. The problematic part is TimestampValidator-4358f8ba.kt which is a name of a file which obviously does not exits because the correct name is TimestampValidator.kt.

Please investigate and resolve.

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