Raku / doc-website

Tooling to build/run the documentation website
Artistic License 2.0
7 stars 10 forks source link

JS error #407

Closed coke closed 1 month ago

coke commented 1 month ago

Trying to search in the TOC, typing anything throws this error:

filtered-toc.js:16 Uncaught TypeError: fuzzysort.highlight is not a function
    at HTMLLIElement.<anonymous> (filtered-toc.js:16:33)
    at jquery.min.js:2:24485
    at Function.grep (jquery.min.js:2:3421)
    at j (jquery.min.js:2:24454)
    at S.fn.init.filter (jquery.min.js:2:25133)
    at HTMLInputElement.<anonymous> (filtered-toc.js:10:55)
    at HTMLInputElement.dispatch (jquery.min.js:2:43064)
    at v.handle (jquery.min.js:2:41048)

and the search does not function.

finanalyst commented 1 month ago

@coke oops. Not sure when this stopped working. However,

coke commented 1 month ago

I have found it useful myself over the past few weeks.

finanalyst commented 1 month ago

when did it stop working? I do not remember changing FilteredToc

coke commented 1 month ago

We don't have automated testing on it, so I don't know. We would probably have to do a git bisect with a locally running copy of the site to find out. I can try this if it would help.

finanalyst commented 1 month ago

@coke some git magic would be appreciated

coke commented 1 month ago

Need some help from @dontlaugh - I have instructions for running the site locally, but it's always using latest, not the checked out version (so doing a git bisect doesn't help in that case)

dontlaugh commented 1 month ago

@coke @finanalyst Here is a way to do it. After ./rendered_html has been generated by the build process, run the following from the root of the repo

podman run \
  -v $PWD/rendered_html:/usr/share/caddy \  # mount host_path:container_path (dir)
  -v $PWD/Caddyfile:/etc/caddy/Caddyfile \  # mount host_path:container_path (single file)
  -p 8080:80 \                              # map host port 8080 to container 80
  docker.io/caddy:latest                    # use the upstream caddy image

I use podman, but you can replace it with docker and the rest of the parameters are the same.

Normally, when we build a docs site container, we pack all these files in, so all we need to do is ship a container to the server.

But in this case, we mount the config file and the static assets into the container at the default paths. That's /etc/caddy/Caddyfile and /usr/share/caddy, respectively.

Leave this running in a terminal, and you should be able to update the rendered html static assets, reload the webpage, and see your changes.

Let me know if it doesn't work. I think it should be pretty portable as long as you have docker or podman installed.

dontlaugh commented 1 month ago

@finanalyst can you link to the fuzzysort repo here, for posterity?

coke commented 1 month ago

https://github.com/farzher/fuzzysort

finanalyst commented 1 month ago

For the record. The ToC filter uses fuzzysort, and ver 3.0.1 changed the API. Previously, the library was sourced from git, so we got the latest version. A cdn with link src="https://cdn.jsdelivr.net/npm/fuzzysort@2.0.4/fuzzysort.min.js has the old API, which allows us to pin the library to a working version.