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

Ability for a standalone file:// is broken #282

Open
Wohlstand opened this issue May 5, 2020 · 3 comments
Open

Ability for a standalone file:// is broken #282

Wohlstand opened this issue May 5, 2020 · 3 comments

Comments

@Wohlstand
Copy link

Hello!

I have documentation for my project at this repository that I gradually porting from a raw HTML into Docute:
https://github.com/WohlSoft/PGE-Editor-Help/tree/docute

However, since some moment it no more works locally and it showing blank pages... (no idea how it worked before, maybe after Firefox 68 release).

I did an attempt to disable CORS:

fetchOptions: {
    mode: 'no-cors',
},

however, it now showing just blank files. The source path I use just "./".
Снимок экрана_2020-05-06_02-35-32

How I did use this?

  • I had to use the latest master state.
  • I did the npm install, and then npm run-script build at repository root.
  • I copied "dist" and "lib" directories into the separate folder at my documentation root (_lib sub-directory).
  • I did the simple HTML file to carry the documentation:
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>Moondust Editor - Manual</title>
    <link rel="stylesheet" href="_lib/docute/dist/docute.css">
    <link rel="stylesheet" href="style.css">
</head>
<body>
<div id="docute"></div>
<script src="_lib/docute/dist/docute.js"></script>
<script src="index.js"></script>
</body>
</html>
  • In index.js I had to declare the documentation tree itself:
let docuteSourceRoot = './';

new Docute({
    target: '#docute',
    title: 'Moondust Editor - Documentation',
    sourcePath: docuteSourceRoot,
    darkThemeToggler: true,
    fetchOptions: {
        mode: 'no-cors',
    },
    detectSystemDarkTheme: true,
    highlight: ['typescript', 'bash'],
    editLinkBase: 'https://github.com/WohlSoft/PGE-Editor-Help/edit/master/',
    editLinkText: 'Edit this page on GitHub',
    sidebar: [
        {
            title: 'Main',
            children: [
                {
                    title: 'Intro',
                    link: '/'
                }
            ]
        }
    });
@egoist
Copy link
Owner

egoist commented May 7, 2020

There doesn't seem be a README.md which it was trying to load in your repo? What's the error shown in your devtools?

A minimal reproduction would help, you can create one with https://codesandbox.io

@Wohlstand
Copy link
Author

Wohlstand commented May 7, 2020

Hello!
It's a minimal example:
docute-issue282-sample.zip

I had to store all pre-built dependencies at the _lib folder and re-using it locally.

It works if it stored on a web server and accessed via HTTP(S), however, when I opening "ko.html" from a local file system directly (accessed via file://), pages showing blank.

In Firefox's console here is no output. Before a moment, I had error against CORS request, however when I had to set the "no-cors", an error has gone, however, no content shown...

AHA! in Yandex-Browser I got the next error:

Fetch API cannot load file:///..../README.md. URL scheme "file" is not supported.

How my example works when it's opened locally without any sort of web server:
Снимок экрана от 2020-05-08 01-53-45
Снимок экрана от 2020-05-08 01-53-15

@Wohlstand
Copy link
Author

Ping?

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

2 participants