Skip to content

check: links inside code samples are reported as missing files #55

Closed

Description

@tenphi

In short

What happens

The loop matches /\]\(([^)\s#]+)(?:#[^)]*)?\)/g in every .md page. It also matches inside fenced code blocks, indented code and inline code spans.

Cookbook's docs explain link syntax with a sample:

```md
[Install](./getting-started.md)
[Architecture](./assets/architecture.svg)
```

There is no assets/architecture.svg: it is an example. harnesspm check fails:

❌ docs/content-sources.md: the link ./assets/architecture.svg points at a missing file

Workaround

Cookbook now shows a reference-style image in that sample ([Architecture][diagram] and [diagram]: ./assets/architecture.svg), which the expression does not match. A page that must show inline link syntax has no workaround.

Proposal

Skip code before matching: fenced and indented code blocks and inline code spans. A Markdown parser (mdast) would do it and would also see reference definitions, which the check skips today. #52 asks to check .mdx pages and to take pages from the tarball; the same parser could serve both.

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