From 6ef181088da2038c83d5b200c2250c4bf9685ead Mon Sep 17 00:00:00 2001 From: Chris Clark Date: Thu, 5 Feb 2026 12:11:30 -0400 Subject: [PATCH] Update fetch_resources script a bit --- .gitattributes | 1 + README.md | 29 +++++++++-------------------- scripts/fetch_resources.sh | 13 ++++++++----- 3 files changed, 18 insertions(+), 25 deletions(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..890f029 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.min.js -diff diff --git a/README.md b/README.md index 31958ae..0ec52e7 100644 --- a/README.md +++ b/README.md @@ -176,7 +176,8 @@ Default value: `"default"` ### Update highlight.js, mermaid, and mathjax -To update the included versions of highlight.js, mermaid, and mathjax, run: +This project includes Javascript and CSS resources for highlight.js, mermaid, +and mathjax. To update those resources, run: ```sh ./scripts/fetch_resources.sh @@ -184,14 +185,11 @@ To update the included versions of highlight.js, mermaid, and mathjax, run: ### Update GitHub CSS -> [!NOTE] -> I haven't automated this because I'm hoping find somewhere else to obtain -> these CSS files. Someone else _must_ create and maintain files like these! I -> just haven't found them. - -The github CSS files in the [resources/github_css][g] directory are slightly +The github CSS files, located in [./resources/github_css][g], are slightly modified versions of what can be generated from the [github-markdown-css][gmc] -project. To generate the CSS, run the `gen_github_css.js` script for every +project. + +To generate the CSS, run the `gen_github_css.js` script for every theme: ```sh @@ -210,23 +208,14 @@ removing the media query and putting the color variables in a `:root` binding. ## See Also -- [grip-mode][grip-mode] - Grip-mode makes an API request to GitHub every time +- [grip-mode][] - Grip-mode makes an API request to GitHub every time re-rendering is needed. The benefit is that you get _exactly_ what GitHub would show. This requires an internet connection, a round-trip to GitHub for every change, and there is very little potential for customizing the HTML. -- [Emacs Application Framework][eaf] - EAF extends Emacs to be able to use - Python and Javascript functions, which somehow allows it to run a browser and - other really cool-looking stuff within Emacs. - - I haven't used this personally yet, as it's a much bigger change than just - installing an Emacs package. But based on the examples, its integration with a - browser is way better than what I've experienced with xwidget-webkit. - -- [Centaur Emacs][centaur] - Centaur Emacs was the first implementation I found +- [Centaur Emacs][] - Centaur Emacs was the first implementation I found for viewing rendered markdown with xwidget-webkit, and helped me understand how to accomplish that. [grip-mode]: https://github.com/seagle0128/grip-mode -[eaf]: https://github.com/emacs-eaf/emacs-application-framework -[centaur]: https://github.com/seagle0128/.emacs.d +[Centaur Emacs]: https://github.com/seagle0128/.emacs.d diff --git a/scripts/fetch_resources.sh b/scripts/fetch_resources.sh index 70132bf..3d07e39 100755 --- a/scripts/fetch_resources.sh +++ b/scripts/fetch_resources.sh @@ -18,18 +18,21 @@ curl -s -X POST \ https://highlightjs.org/api/download \ > "$tempdir/out.zip" -echo "Extracting resource bundle to: $tempdir" +echo "Wrote highlightjs resource bundle to $tempdir/out.zip" + +echo "Extracting highlightjs resource bundle in $tempdir" unzip -q \ -d "$tempdir" \ "$tempdir/out.zip" -d=resources/highlight_css -css_files=$(find "$tempdir/styles/" ! -name "*.min.css") -for f in $css_files; do +echo "Copying highlightjs CSS files to resources/highlight_css" + +highlightjs_css_files=$(find "$tempdir/styles/" -type f ! -name "*.min.css") +for f in $highlightjs_css_files; do # Parameter expansion to remove prefix pattern file_name="${f##*/}" - cp "$f" "$d/$file_name" + cp "$f" "resources/highlight_css/$file_name" done echo "Downloading highlight.min.js from CDN"