highlightjs / highlight.js

JavaScript syntax highlighter with language auto-detection and zero dependencies.
https://highlightjs.org/
BSD 3-Clause "New" or "Revised" License
23.61k stars 3.58k forks source link

(request org repo) highlightjs-phix #3727

Open petelomax opened 1 year ago

petelomax commented 1 year ago

I would like to request the creation of a highlightjs-phix repository for my 3rd party grammar.

I know very little about cdn or node.

Metadata

Requirements

Afterwards

Submit a PR that:

joshgoebel commented 1 year ago

Please go ahead and complete the requirements fully and I can get this setup for you.

joshgoebel commented 1 year ago

Ping.

petelomax commented 1 year ago

Pong. What are CJS and ESM builds anyway? I was thinking of adding a section for use on Node.js along the lines of "submit a PR with any needed changes and full instructions, then after that has been merged, simply follow those instructions."

joshgoebel commented 1 year ago

Different JS standards, long story. If you follow the 3rd party guide and use our own ./tools/build -t cdn the build process will create the dist folder for you (along with CJS and ESM versions), you merely need to check them into GitHub.

Here is a typical Node example from another repo:

https://github.com/highlightjs/highlightjs-robots-txt#with-node-or-another-build-system

joshgoebel commented 1 year ago

This will likely all change when we go ESM only with v12, but until then we do like to see all 3rd party modules support our "drop-in" CDN build format... which is just a CJS file that self-registers (which again we'll build for you)... like all the grammars we ship as part of our CDN package.

joshgoebel commented 1 year ago

Ping.

petelomax commented 1 year ago

No idea whether what I've just done is anything close to what you meant.

joshgoebel commented 7 months ago

If you follow the 3rd party guide and use our own ./tools/build -t cdn the build process will create the dist folder for you (along with CJS and ESM versions), you merely need to check them into GitHub.

Did you try this?

petelomax commented 7 months ago

Sure: F:\misc\highlightjs\highlight.js>node .\tools\build.js -t cdn Starting build. Finished build. Writing style files. node:fs:737 handleErrorFromBinding(ctx); ^

Error: EINVAL: invalid argument, read at Object.readSync (node:fs:737:3) at tryReadSync (node:fs:432:20) at Object.readFileSync (node:fs:478:19) at new Language (F:\misc\highlightjs\highlight.js\tools\lib\language.js:27:20) at Language.fromFile (F:\misc\highlightjs\highlight.js\tools\lib\language.js:67:12) at getLanguages (F:\misc\highlightjs\highlight.js\tools\lib\language.js:108:26) at async Object.buildCDN [as build] (F:\misc\highlightjs\highlight.js\tools\build_cdn.js:39:21) at async doTarget (F:\misc\highlightjs\highlight.js\tools\build.js:90:3) { errno: -4071, syscall: 'read', code: 'EINVAL' }

Node.js v19.3.0

F:\misc\highlightjs\highlight.js>

joshgoebel commented 6 months ago

I'd suggest trying the build on linux or linux subsystem... unless someone who is a windows experts wants to come along and dig into this...