hyperledger / anoncreds-spec

The specification for AnonCreds verifiable credential exchange.
https://hyperledger.github.io/anoncreds-spec/
Apache License 2.0
45 stars 24 forks source link

Enable katex support for support latex math #109

Closed swcurran closed 1 year ago

swcurran commented 1 year ago

Signed-off-by: Stephen Curran swcurran@gmail.com

swcurran commented 1 year ago

Adds support for latex when locally deploying and (hopefully) when rendered in gh-pages.

Some of the existing attempts at latex are rendering properly (see section 8.1 Credential Offer), but some are not (same section). I suspect it is in the text in the spec, not a problem in the engine, but we'll need to look at it.

@whalelephant -- I'm hoping this works for you and you can take a look.

@ArPhil @TelegramSam @hkny -- can one of you review and approve this PR?

Thanks!

whalelephant commented 1 year ago

@swcurran tested you branch and it works locally. Some differences in latex parsing so I will do PR after this gets merged.

swcurran commented 1 year ago

When I change it to just what you suggest and try to run locally, I get an error. Any idea what the problem is?

~/repos/anoncreds-spec [enable-katex] 13:26 $ npm run edit
npm ERR! missing script: edit

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/swcur/.npm/_logs/2022-12-07T21_26_20_601Z-debug.log
~/repos/anoncreds-spec [enable-katex !] 13:26 $ cat /home/swcur/.npm/_logs/2022-12-07T21_26_20_601Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'edit' ]
2 info using npm@6.14.12
3 info using node@v10.24.1
4 verbose stack Error: missing script: edit
4 verbose stack     at run (/usr/lib/node_modules/npm/lib/run-script.js:155:19)
4 verbose stack     at /usr/lib/node_modules/npm/lib/run-script.js:63:5
4 verbose stack     at /usr/lib/node_modules/npm/node_modules/read-package-json/read-json.js:116:5
4 verbose stack     at /usr/lib/node_modules/npm/node_modules/read-package-json/read-json.js:436:5
4 verbose stack     at checkBinReferences_ (/usr/lib/node_modules/npm/node_modules/read-package-json/read-json.js:391:45)
4 verbose stack     at final (/usr/lib/node_modules/npm/node_modules/read-package-json/read-json.js:434:3)
4 verbose stack     at then (/usr/lib/node_modules/npm/node_modules/read-package-json/read-json.js:161:5)
4 verbose stack     at /usr/lib/node_modules/npm/node_modules/read-package-json/read-json.js:382:12
4 verbose stack     at /usr/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:123:16
4 verbose stack     at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3)
5 verbose cwd /home/swcur/repos/anoncreds-spec
6 verbose Linux 4.15.0-200-generic
7 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "edit"
8 verbose node v10.24.1
9 verbose npm  v6.14.12
10 error missing script: edit
11 verbose exit [ 1, true ]
andrewwhitehead commented 1 year ago

I think you need to re-fork the main branch and apply only the change I mentioned, then set the "katex": true flag in specs.json. Right now you don't have an edit action because package.json was replaced. Also, when exporting the generated site you will want to copy the fonts directory.

swcurran commented 1 year ago

I've done that, but the latex strings don't render locally, but do with the other changes I made. New branch here: https://github.com/swcurran/anoncreds-spec/tree/enable-katex

If I remove ALL except the dependencies (is that what you meant?) -- I get the "no edit command" error.

Regards the fonts folder -- it is getting created, and is .gitignored in the "main" branch, but I think it will get picked up in the gh-pages branch, which is what we are publishing from. If not, we will have to adjust the GHA that publishes after a merge.

swcurran commented 1 year ago

FYI -- I put back all the other changes outside of package.json and no change -- latex strings not rendered.

Should I be updating index.js, gulpfile regularly to stay up with what is in the Spec-Up repo?

swcurran commented 1 year ago

And further -- assets, src folders? Should they be updated as they evolve in the spec-up repo?