Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v14] Error occurs when specifying a custom theme. #1634

Open
shsatovg opened this issue Mar 13, 2024 · 0 comments
Open

[v14] Error occurs when specifying a custom theme. #1634

shsatovg opened this issue Mar 13, 2024 · 0 comments

Comments

@shsatovg
Copy link

shsatovg commented Mar 13, 2024

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
    1. Install documentation.js
    • npm i -D documentation@latest
    1. Create custom theme (copy defalut theme to create custom theme)
    • cp -r node_modules/documentation/src/default_theme custom_theme
    1. 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();
    
    1. Create input file (copy build.js to create index.js)
    • cp build.mjs index.js
    1. Build the documentation
    • node build.mjs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant