Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.min.js -diff
29 changes: 9 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,22 +176,20 @@ 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
```

### 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
Expand All @@ -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
13 changes: 8 additions & 5 deletions scripts/fetch_resources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down