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

Generate completely static page #97

Closed
Regenhardt opened this issue Dec 30, 2024 · 8 comments
Closed

Generate completely static page #97

Regenhardt opened this issue Dec 30, 2024 · 8 comments

Comments

@Regenhardt
Copy link

Currently, the cli tool generates an html file with embedded javascript, which in turn creates the dark mode toggle, github corner, and maybe some other stuff affecting layout/design.
This creates a worse site when viewed with scripts disabled.

Could the generator instead fully generate the final html so the final state will always be loaded directly, without having to run scripts for it to be finished?

@jaywcjlove
Copy link
Owner

@Regenhardt Currently, the dark/light theme switch, Markdown preview (as a web component), and code copying features all rely on JavaScript. Is it possible to modify only the Markdown preview part? If so, I can make the changes quickly.

@Regenhardt
Copy link
Author

That could be enough I think. I guess it depends on what other elements are already in the layout before running the scripts, in order for the markdown part to be properly displayed.

@jaywcjlove
Copy link
Owner

@Regenhardt Upgrade v5.0

@Regenhardt
Copy link
Author

Happy new year!

Upgraded to v5, something is broken now, not sure why. Downgraded to make sure, and it works with the same setup. Here's my console output:

PS D:\Sources\regenhardt.dev> npm install -g [email protected]

changed 243 packages in 14s

162 packages are looking for funding
  run `npm fund` for details
PS D:\Sources\regenhardt.dev> markdown-to-html --source .\index.md

markdown-to-html: index.html

PS D:\Sources\regenhardt.dev> npm install -g markdown-to-html-cli@latest

changed 243 packages in 8s

162 packages are looking for funding
  run `npm fund` for details
PS D:\Sources\regenhardt.dev> markdown-to-html --source .\index.md
node:fs:441
    return binding.readFileUtf8(path, stringToFlags(options.flag));
                   ^

Error: ENOENT: no such file or directory, open 'D:\C:\Users\[redacted]\AppData\Roaming\npm\node_modules\markdown-to-html-cli\lib\nodes\markdown.css'
    at Object.readFileSync (node:fs:441:20)
    at file:///C:/Users/[redacted]/AppData/Roaming/npm/node_modules/markdown-to-html-cli/lib/nodes/markdown-style.js:5:27
    at ModuleJob.run (node:internal/modules/esm/module_job:271:25)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:547:26)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:116:5) {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'open',
  path: 'D:\\C:\\Users\\[redacted]\\AppData\\Roaming\\npm\\node_modules\\markdown-to-html-cli\\lib\\nodes\\markdown.css'
}

Node.js v22.12.0

Reading it again, I just realized some paths start like D:\C:\, I totally understand the PC not finding anything there. The tool is installed under C:\, the pwd is under D:\.

@mserajnik
Copy link

mserajnik commented Jan 1, 2025

Upgraded to v5, something is broken now, not sure why. Downgraded to make sure, and it works with the same setup.

I also get an error with the latest version, although a different one:

node:fs:448
    return binding.readFileUtf8(path, stringToFlags(options.flag));
                   ^

Error: ENOENT: no such file or directory, open '/Users/wangchujiang/git-project/github/markdown-to-html-cli/packages/cli/lib/nodes/github-corners.css'
    at Object.readFileSync (node:fs:448:20)
    at /__w/_actions/jaywcjlove/markdown-to-html-cli/main/packages/action/dist/action.js:164687:39
    at /__w/_actions/jaywcjlove/markdown-to-html-cli/main/packages/action/dist/action.js:167762:3
    at Object.<anonymous> (/__w/_actions/jaywcjlove/markdown-to-html-cli/main/packages/action/dist/action.js:167765:12)
    at Module._compile (node:internal/modules/cjs/loader:[14](https://github.com/mserajnik/flatpak.mser.at/actions/runs/12574069103/job/35047721186#step:6:15)69:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:[15](https://github.com/mserajnik/flatpak.mser.at/actions/runs/12574069103/job/35047721186#step:6:16)48:10)
    at Module.load (node:internal/modules/cjs/loader:1288:32)
    at Module._load (node:internal/modules/cjs/loader:1104:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:[17](https://github.com/mserajnik/flatpak.mser.at/actions/runs/12574069103/job/35047721186#step:6:18)4:12)
    at node:internal/main/run_main_module:28:49 {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/Users/wangchujiang/git-project/github/markdown-to-html-cli/packages/cli/lib/nodes/github-corners.css'
}

Here's my (unchanged) configuration for the GH Actions workflow which has been working until v5:

- name: Generate index.html file
  uses: jaywcjlove/markdown-to-html-cli@main
  with:
    source: README.md
    output: index.html
    title: flatpak.mser.at
    description: Various things missing from Flathub
    favicon: [removed from snippet because of length]
    github-corners: https://github.com/mserajnik/flatpak.mser.at

@jaywcjlove
Copy link
Owner

@Regenhardt @mserajnik It looks like I fixed it. upgrade v5.0.2

image

@mserajnik
Copy link

It looks like I fixed it

I can confirm it's working again for me now. Thanks!

@Regenhardt
Copy link
Author

Yes works very nicely now, thank you!

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

3 participants