yzhang-gh / vscode-markdown

Markdown All in One
https://marketplace.visualstudio.com/items?itemName=yzhang.markdown-all-in-one
MIT License
2.91k stars 322 forks source link

add zola slug strategy #1419

Closed float3 closed 4 months ago

float3 commented 5 months ago

https://github.com/yzhang-gh/vscode-markdown/issues/1417#issuecomment-2078624439

float3 commented 5 months ago

I need guidance with testing and let me know if you're happy with this build process as described in the scripts in package.json

float3 commented 5 months ago

I guess now that I think about it, a slightly better way of doing this might be uploading the package to npm and just pulling it in, then you won't have to deal with building it, let me know what you think

float3 commented 5 months ago

building works fine, but testing doesn't, the TOC annotations aren't even showing up

float3 commented 5 months ago

@yzhang-gh let me know once you get to it (: thanks for your help

yzhang-gh commented 5 months ago

Many thanks.

I guess now that I think about it, a slightly better way of doing this might be uploading the package to npm and just pulling it in, then you won't have to deal with building it, let me know what you think

I think so and I guess then it won't break the current CI. Would you mind hosting this zola-slug npm package?

float3 commented 5 months ago

the broken CI is because I made a mistake, we need to build the rust project before running npm ci I guess, but a separate npm package is probably the better approach, I will host it!

float3 commented 5 months ago

@yzhang-gh I realized the problem with this is that unless you wanna read the wasm you can't verify what code is in https://www.npmjs.com/package/zola-slug?activeTab=code

I compiled it with wasm-pack but you probably shouldn't just trust me

let me know how you wish to proceed

yzhang-gh commented 5 months ago

Thanks for the heads up. Then I think it would be better if the build process is also public (e.g. GitHub Action? GitHub Packages?), although I remember I tried it many years ago and it didn't work 😂.

float3 commented 5 months ago

@yzhang-gh now the workflow should work and I tested the final vsix by using it on my website https://github.com/float3/float3.github.io/commit/80b82870caf74ed570d0ef39b80c9ff0b3c29c7c the toc here was generated with the new slugify strategy

the build process here is public, we're not using the npmjs package

float3 commented 5 months ago

looks like the action still doesn't work, not sure why right now, the steps described in the workflow work perfectly when I run it on my local machine

float3 commented 5 months ago

converting to draft for now while I figure some things out

float3 commented 5 months ago

ci is passing and the extension is working https://github.com/float3/vscode-markdown/actions

here is a demo https://github.com/float3/float3.github.io/blob/master/content/notes/food.md?plain=1#L10-L39 you should be able to try it yourself

float3 commented 5 months ago

I think it's ready for review @yzhang-gh

yzhang-gh commented 5 months ago

Nice work. I will try to take a look soon.

float3 commented 5 months ago

if you're more experienced with webpack let me know if you know a better way of doing this

float3 commented 5 months ago

it looks like I can maybe use CopyPlugin or module rules to copy the file to the right place, then we can avoid the bad CI change I made

edit: it worked, we fixed it

yzhang-gh commented 5 months ago

Amazing!

if you're more experienced with webpack

Unfortunately no 🥲, but happy to see you did it.

float3 commented 4 months ago

like this the first time zola slugify will always fail on my machine, and always succeed on the second try since this way it's a race condition, I'm open to suggestions

float3 commented 4 months ago

now additionally we could do some error handling if it hasn't finished importing yet

float3 commented 4 months ago

@yzhang-gh can you take another look over the changes

yzhang-gh commented 4 months ago

🍻

float3 commented 4 months ago

好的! 🥳