documentationjs / documentationjs/documentation

[v14] Error occurs when specifying a custom theme.

Open
#1,634 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
5.8k
Forks
481
PR merge metrics
No merged PRs in 30d

Description

### Description

Error occurs when specifying custom theme on v14 series.

### How are you running documentation.js
Node.js API

### Version

documentation.js version:v14.0.3
Node.js version: v20.10.0
OS: Windows 10

### The current behavior

When I specify the custom theme and run it, I get the following error in the console log.

```
node:internal/modules/esm/load:236
throw new ERR_UNSUPPORTED_ESM_URL_SCHEME(parsed, schemes);
^

Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol
'c:'
at throwIfUnsupportedURLScheme (node:internal/modules/esm/load:236:11)
at defaultLoad (node:internal/modules/esm/load:128:3)
at ModuleLoader.load (node:internal/modules/esm/loader:409:13)
at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:291:56)
at new ModuleJob (node:internal/modules/esm/module_job:65:26)
at #createModuleJob (node:internal/modules/esm/loader:303:17)
at ModuleLoader.getJobFromResolveResult (node:internal/modules/esm/loader:260:34)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:241:17)
at async ModuleLoader.import (node:internal/modules/esm/loader:328:23) {
code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'
}

```

### The expected behavior

Specify the custom theme and run it to output documentation with the custom theme applied.

### input code,output documentation

For all codes that do not depend on the input code, output documentation is not printed and an error is generated in the console. (More information on console errors can be found in "The current behavior".)

### Steps To Reproduce

* 1. Create new project folder & npm initialize
* `mkdir doc && cd doc && npm init -y`
* 2. Install documentation.js
* `npm i -D documentation@latest`
* 3. Create custom theme (copy defalut theme to create custom theme)
* `cp -r node_modules/documentation/src/default_theme custom_theme`
* 4. Create build script (build.mjs)
```
// build.mjs
import * as documentation from 'documentation';

const runDocumentation = async () => {
const comments = await documentation.build(['index.js']);
const output = await documentation.formats.html(comments, {theme: 'custom_theme'});
};

runDocumentation();
```
* 5. Create input file (copy build.js to create index.js)
* `cp build.mjs index.js`
* 6. Build the documentation
* `node build.mjs`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.