denoland / denoland/deno_doc

[HTML] example "usage" imports are syntactically incorrect

Open
#591 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
297
Forks
73
Avg merge
5h 20m
Merged PRs (30d)
18

Description

The generated example usage code (for importing symbols from the modules) have been erroneous for quite a while now.

First off, none of the paths are incorrectly formatted, and always appear as just the filename without any relative `./` prefix or anything. For example, `import { titleCase } from "title-case.ts";`. Copy and paste that into the REPL and see how it goes.

It'd be great if there was a way for deno_doc to pick up on the JSR configuration in the deno.json file, and format imports accordingly. Like `import { isString } from "jsr:@type/is/string";` (wishful thinking for the future). But in the mean time, I think at the very least it should be formatting relative paths properly.

Now, for default exports (as I mentioned in #590), the generated import seems to get really funky. The identifier it uses **always** ends up being... a single dot. Yup, when viewing a default export, the suggested usage code I get is `import . from "capitalize.ts";`.

For context, I run canary releases of Deno 99% of the time. I make sure to stay on top of upgrading to the latest build regularly (sometimes several times a day 😅). On the latest build, this erroroneous behavior is still persisting.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the code that generates HTML example-usage imports in deno_doc, then reproduce the named-export and default-export cases described here. Done means generated examples use valid relative paths and a valid identifier for default exports; add or run coverage for both cases if the project has it.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.