mirror of
https://github.com/varkor/quiver.git
synced 2024-10-26 07:09:37 +03:00
Use prebuilt release of KaTeX rather than a git submodule
This commit is contained in:
parent
c5818ced70
commit
14c85349ff
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
src/KaTeX/*
|
4
.gitmodules
vendored
4
.gitmodules
vendored
@ -1,4 +0,0 @@
|
||||
[submodule "src/KaTeX"]
|
||||
path = src/KaTeX
|
||||
url = https://github.com/KaTeX/KaTeX.git
|
||||
shallow = true
|
27
Makefile
27
Makefile
@ -6,10 +6,10 @@
|
||||
# Build KaTeX.
|
||||
all:
|
||||
set -e
|
||||
git submodule update --init --recursive
|
||||
cd src/KaTeX
|
||||
yarn
|
||||
yarn build
|
||||
curl -L -O "https://github.com/KaTeX/KaTeX/releases/download/v0.12.0/katex.zip"
|
||||
unzip katex.zip
|
||||
rm katex.zip
|
||||
mv katex src/KaTeX
|
||||
|
||||
# Update the `dev` branch from `master`.
|
||||
dev:
|
||||
@ -55,7 +55,6 @@ gh-pages:
|
||||
# for `subtree split` later, which has to iterate through the entire history of the branch.
|
||||
git reset $$TAIL
|
||||
git add -A
|
||||
git rm -r --cached src/KaTeX
|
||||
git commit -m "Add release branch"
|
||||
# Split off the `src/` directory into its own branch.
|
||||
RELEASE=$$(git subtree split --prefix=src)
|
||||
@ -65,7 +64,6 @@ gh-pages:
|
||||
git checkout -b squashed
|
||||
git reset $$TAIL
|
||||
git add -A
|
||||
git rm -r --cached src/KaTeX
|
||||
git commit -m "Add dev branch"
|
||||
DEV=$$(git subtree split --prefix=src)
|
||||
|
||||
@ -77,23 +75,6 @@ gh-pages:
|
||||
# Reset the GitHub Pages branch so that it contains the release source code.
|
||||
git reset --hard $$RELEASE
|
||||
|
||||
# Clone the existing version of KaTeX into the worktree.
|
||||
git clone $$KATEX KaTeX
|
||||
# We are assuming KaTeX has already been built.
|
||||
# Remove `.git` and associated files, so KaTeX is no longer recognised as a git repository.
|
||||
cd KaTeX
|
||||
rm -rf .git
|
||||
rm .gitignore
|
||||
rm .gitmodules
|
||||
# We need to be able to commit KaTeX as a plain directory, so we have to unregister it as a
|
||||
# submodule. The cloned repository by default won't contain any `.gitignore`d files, but we
|
||||
# actually want the `dist/`, directory, which contains various resources, e.g. fonts, so we copy
|
||||
# it across ourselves.
|
||||
cp -r $$KATEX/dist .
|
||||
cd ../
|
||||
git add -A
|
||||
git commit -m "Add KaTeX"
|
||||
|
||||
# Merge the development branch into the `dev/` directory.
|
||||
git merge -s ours --no-commit $$DEV
|
||||
git read-tree --prefix=dev -u $$DEV
|
||||
|
19
README.md
19
README.md
@ -82,21 +82,12 @@ Currently, macros may be defined using `\newcommand`, and colours may be defined
|
||||
`\definecolor` (using the colour modes: `rgb`, `RGB` or `gray`).
|
||||
|
||||
## Building
|
||||
Make sure you have [installed yarn](https://yarnpkg.com/lang/en/docs/install/) and have a version of
|
||||
Make that supports `.ONESHELL` (e.g. GNU Make 3.82).
|
||||
Run `make` from the command land, and then open `src/index.html` in your favourite web browser.
|
||||
|
||||
Clone the repository, and run
|
||||
```shell
|
||||
make
|
||||
```
|
||||
which will build KaTeX. Then simply open `src/index.html` in your favourite web browser.
|
||||
|
||||
**Note for macOS users:** the default version of Make on macOS is GNU Make 3.81, which does not
|
||||
contain support for `.ONESHELL`. You may need to update Make to run the Makefile.
|
||||
|
||||
**Note for Ubuntu users:** the cmdtest package that comes with Ubuntu conflicts with the yarn
|
||||
installation. You may need to [uninstall cmdtest](https://github.com/varkor/quiver/issues/48) to
|
||||
install yarn.
|
||||
If this fails, you might be using an incompatible version of Make or Bash. In this case, you can
|
||||
manually download the [latest release](https://github.com/KaTeX/KaTeX/releases) of KaTeX and place
|
||||
it under `src/` as `src/KaTeX/`. Then open `src/index.html` in your favourite web browser. If KaTeX
|
||||
has not been given the correct path, you will get an error telling you that KaTeX failed to load.
|
||||
|
||||
If you have any other problems building **quiver**, [open an
|
||||
issue](https://github.com/varkor/quiver/issues/new) detailing the problem and I'll try to help.
|
||||
|
6
src/.gitmodules
vendored
6
src/.gitmodules
vendored
@ -1,6 +0,0 @@
|
||||
# [submodule "MathJax"]
|
||||
# path = MathJax
|
||||
# url = https://github.com/mathjax/MathJax.git
|
||||
[submodule "KaTeX"]
|
||||
path = KaTeX
|
||||
url = https://github.com/KaTeX/KaTeX.git
|
@ -6595,7 +6595,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
// Immediately load the KaTeX library.
|
||||
const rendering_library = new DOM.Element("script", {
|
||||
type: "text/javascript",
|
||||
src: "KaTeX/dist/katex.js",
|
||||
src: "KaTeX/katex.min.js",
|
||||
}).listen("error", () => {
|
||||
// Handle KaTeX not loading (somewhat) gracefully.
|
||||
UI.display_error(`KaTeX failed to load.`)
|
||||
@ -6614,14 +6614,14 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
// Load the style sheet needed for KaTeX.
|
||||
document.head.appendChild(new DOM.Element("link", {
|
||||
rel: "stylesheet",
|
||||
href: "KaTeX/dist/katex.css",
|
||||
href: "KaTeX/katex.css",
|
||||
}).element);
|
||||
// Preload various fonts to avoid flashes of unformatted text.
|
||||
const preload_fonts = ["Main-Regular", "Math-Italic"];
|
||||
for (const font of preload_fonts) {
|
||||
const attributes = {
|
||||
rel: "preload",
|
||||
href: `KaTeX/dist/fonts/KaTeX_${font}.woff2`,
|
||||
href: `KaTeX/fonts/KaTeX_${font}.woff2`,
|
||||
as: "font"
|
||||
};
|
||||
if (window.location.hostname !== "") {
|
||||
|
Loading…
Reference in New Issue
Block a user