kazumatu981 / markdown-it-kroki

markdown-it kroki plugin.
MIT License
5 stars 2 forks source link

Use Buffer.from explicitly when using zlib #16

Closed drorgl closed 2 months ago

drorgl commented 2 months ago

Problem:

Using markdown-it-kroki inside an obsidian marp plugin fails to compress the diagram properly and produces 400 error on kroki

Desired Result

Diagrams show up properly on obsidian marp plugin

Cause:

To compile obsidian plugins for use in both mobile and desktop, the plugins needs to be packed for web only. The packed zlib-browserify is using pako which does not support compressing strings, the proposed change solves that issue by adding Buffer.from.

Further information:

the default browserify buffer module does not support base64url, so I'm using an alternative from feross (specifically pr 314) I didn't want to add extra noise by adding more changes to this plugin by modifying the base64url as well.