merge upstream

This commit is contained in:
Niklas Buschmann 2021-03-11 21:55:04 +01:00
parent 2671ef78fb
commit 63f216c575
25 changed files with 6537 additions and 5056 deletions

View File

@ -1,68 +1,78 @@
@font-face { @font-face {
font-family: 'PT Sans'; font-family: "PT Sans";
src: local("PT Sans"), local("PTSans-Regular"), url("../fonts/PTSans-Regular.woff") format("woff"); src: local("PT Sans"), local("PTSans-Regular"), url("../fonts/PTSans-Regular.woff") format("woff");
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
} }
@font-face { @font-face {
font-family: 'PT Sans'; font-family: "PT Sans";
src: local("PT Sans Bold"), local("PTSans-Bold"), url("../fonts/PTSans-Bold.woff") format("woff"); src: local("PT Sans Bold"), local("PTSans-Bold"), url("../fonts/PTSans-Bold.woff") format("woff");
font-weight: bold; font-weight: bold;
font-style: normal; font-style: normal;
} }
html { html {
background: #66697c;
font-size: 16px; font-size: 16px;
font-size: calc(0.8rem + 0.3vw); font-size: calc(0.8rem + 0.3vw);
padding: 0 calc(38% - 20em); background: #66697c;
padding: 0 calc(38% - 21em);
} }
body { body {
background: #ffffff;
color: #212228;
font-family: "PT Sans", -apple-system, "Helvetica Neue", "Segoe UI", "Roboto", sans-serif; font-family: "PT Sans", -apple-system, "Helvetica Neue", "Segoe UI", "Roboto", sans-serif;
font-weight: 400; font-weight: 400;
background: #ffffff;
color: #1c1d22;
box-shadow: 0 0 0 1px rgba(102, 105, 124, 0.3);
margin: 0;
line-height: 1.6; line-height: 1.6;
margin: 0;
min-height: 100vh; min-height: 100vh;
-webkit-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
h1, h2, h3, h4, h5, h6 {
font-weight: 600;
}
b, strong, th { b, strong, th {
font-weight: 600; font-weight: 600;
} }
a { p {
color: inherit; text-align: justify;
text-decoration: inherit;
} }
a {
color: #68f;
text-decoration: inherit;
}
a:hover { a:hover {
text-decoration: underline; text-decoration: underline;
} }
article a { header a, footer a, aside a {
color: #68f; color: inherit;
} }
header time { header time {
color: #8e8e91; color: #909194;
} }
hr { hr {
border: 1px solid rgba(142, 142, 145, 0.3); border: 1px solid rgba(144, 145, 148, 0.3);
margin: 2em 0; margin: 2em 0;
} }
article:not(:last-of-type) {
border-bottom: 1.5px solid rgba(144, 145, 148, 0.2);
}
blockquote { blockquote {
background: rgba(142, 142, 145, 0.06); background: rgba(144, 145, 148, 0.06);
border-left: 3px solid rgba(142, 142, 145, 0.9); border-left: 3px solid rgba(144, 145, 148, 0.9);
padding: 1px 1.5em; padding: 1px 1.5em;
opacity: .75; opacity: 0.75;
} }
blockquote, figure { blockquote, figure {
@ -70,7 +80,7 @@ blockquote, figure {
} }
img, li { img, li {
margin: .5em 0; margin: 0.5em 0;
} }
img { img {
@ -80,47 +90,52 @@ img {
} }
table { table {
width: 100%; display: inline-block;
max-width: 100%;
overflow-y: scroll;
border-spacing: 1px; border-spacing: 1px;
box-shadow: 0 0 0 1px rgba(142, 142, 145, 0.12) inset; border-radius: 2px;
box-shadow: 0 0 0 1px rgba(144, 145, 148, 0.12) inset;
} }
th, td { th, td {
padding: .5em 1em; padding: 0.5em 1em;
box-shadow: 0 0 0 1px rgba(142, 142, 145, 0.12); box-shadow: 0 0 0 1px rgba(144, 145, 148, 0.12);
} }
tr:hover, tr:nth-child(odd) td { tr:hover, tr:nth-child(odd) td {
background: rgba(142, 142, 145, 0.04); background: rgba(144, 145, 148, 0.04);
} }
pre { pre {
background: rgba(40, 41, 48, 0.9)!important; background: rgba(144, 145, 148, 0.12);
color: #ffffff;
border-radius: 2px; border-radius: 2px;
font-size: .8em; font-size: 0.8em;
margin: 1.5em 0; margin: 1.5em 0;
padding: .8em 1.2em; padding: 0.8em 1.2em;
overflow-x: auto; overflow-x: auto;
} }
:not(pre) > code { :not(pre) > code {
font-size: .9em; font-size: 0.9em;
background: rgba(142, 142, 145, 0.15); background: rgba(144, 145, 148, 0.15);
opacity: .7; opacity: 0.7;
border-radius: 2px; border-radius: 2px;
margin: 0 .1em; margin: 0 0.1em;
padding: .2em .4em; padding: 0.2em 0.4em;
} }
body > header { body > header, body > footer {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: space-between;
align-items: center; align-items: center;
justify-content: space-between;
background: #2a2c33; background: #2a2c33;
color: #ffffff; color: #ffffff;
border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
body > header, body > article, body > footer {
padding: 1.5em;
} }
article header { article header {
@ -129,41 +144,33 @@ article header {
article header h1 { article header h1 {
font-size: 1.7em; font-size: 1.7em;
margin: 0 0 .1em; margin: 0 0 0.1em;
} }
nav { nav {
margin: .5em -1em; margin: 0.5em -1em;
} }
nav a { nav a {
margin: .5em 1em; margin: 0.5em 1em;
}
body > header, body > article {
padding: 1.65em calc(20% - 4em);
padding: 1.65em max(calc(20% - 4em), 1.5em);
} }
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
html, body, body > header { html, body, body > header, body > footer {
background: #1c1d22; background: #212228;
color: #ffffff; color: #ffffff;
box-shadow: 0 0 0 1px #33353e;
}
}
@media (min-width: 32em) {
body > header, body > article, body > footer {
padding: 1.65em calc(22% - 6em);
} }
} }
.title { .title {
font-size: 1.4em; font-size: 1.3em;
}
.archive {
font-size: 1.1em;
}
.archive time {
display: inline-block;
min-width: 10ch;
margin: 0 .2em;
} }
.more { .more {
@ -173,8 +180,8 @@ body > header, body > article {
.more a { .more a {
border-radius: 2px; border-radius: 2px;
border: 1.5px solid #68f; border: 1.5px solid #68f;
padding: .4em .8em; padding: 0.4em 0.8em;
transition: .2s background, .2s color; transition: 0.2s background, 0.2s color;
} }
.more a:hover { .more a:hover {
@ -182,3 +189,23 @@ body > header, body > article {
background: #68f; background: #68f;
text-decoration: inherit; text-decoration: inherit;
} }
.archive {
font-size: 1.1em;
}
.archive time {
display: inline-block;
min-width: 10ch;
margin: 0 0.2em;
}
.highlight pre {
background: rgba(47, 48, 57, 0.9)!important;
color: white!important;
}
.katex {
overflow-x: auto;
overflow-y: hidden;
}

View File

@ -1,11 +1,11 @@
@font-face { @font-face {
font-family: 'PT Sans'; font-family: "PT Sans";
src: local("PT Sans"), local("PTSans-Regular"), url("../fonts/PTSans-Regular.woff") format("woff"); src: local("PT Sans"), local("PTSans-Regular"), url("../fonts/PTSans-Regular.woff") format("woff");
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
} }
@font-face { @font-face {
font-family: 'PT Sans'; font-family: "PT Sans";
src: local("PT Sans Bold"), local("PTSans-Bold"), url("../fonts/PTSans-Bold.woff") format("woff"); src: local("PT Sans Bold"), local("PTSans-Bold"), url("../fonts/PTSans-Bold.woff") format("woff");
font-weight: bold; font-weight: bold;
font-style: normal; font-style: normal;
@ -17,12 +17,12 @@ html {
} }
body { body {
background: #ffffff;
color: #212228;
font-family: "PT Sans", -apple-system, "Helvetica Neue", "Segoe UI", "Roboto", sans-serif; font-family: "PT Sans", -apple-system, "Helvetica Neue", "Segoe UI", "Roboto", sans-serif;
font-weight: 400; font-weight: 400;
background: #ffffff;
color: #1c1d22;
margin: 0;
line-height: 1.6; line-height: 1.6;
margin: 0;
min-height: 100vh; min-height: 100vh;
-webkit-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
@ -31,42 +31,53 @@ body {
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
body { body {
background: #1c1d22; background: #212228;
color: #ffffff; color: #ffffff;
} }
} }
h1, h2, h3, h4, h5, h6 {
font-weight: 600;
}
b, strong, th { b, strong, th {
font-weight: 600; font-weight: 600;
} }
a { p {
color: inherit; text-align: justify;
text-decoration: inherit;
} }
a {
color: #68f;
text-decoration: inherit;
}
a:hover { a:hover {
text-decoration: underline; text-decoration: underline;
} }
article a { header a, footer a, aside a {
color: #68f; color: inherit;
} }
header time { header time {
color: #8e8e91; color: #909194;
} }
hr { hr {
border: 1px solid rgba(142, 142, 145, 0.3); border: 1px solid rgba(144, 145, 148, 0.3);
margin: 2em 0; margin: 2em 0;
} }
article:not(:last-of-type) {
border-bottom: 1.5px solid rgba(144, 145, 148, 0.2);
}
blockquote { blockquote {
background: rgba(142, 142, 145, 0.06); background: rgba(144, 145, 148, 0.06);
border-left: 3px solid rgba(142, 142, 145, 0.9); border-left: 3px solid rgba(144, 145, 148, 0.9);
padding: 1px 1.5em; padding: 1px 1.5em;
opacity: .75; opacity: 0.75;
} }
blockquote, figure { blockquote, figure {
@ -74,7 +85,7 @@ blockquote, figure {
} }
img, li { img, li {
margin: .5em 0; margin: 0.5em 0;
} }
img { img {
@ -84,46 +95,50 @@ img {
} }
table { table {
width: 100%; display: inline-block;
max-width: 100%;
overflow-y: scroll;
border-spacing: 1px; border-spacing: 1px;
box-shadow: 0 0 0 1px rgba(142, 142, 145, 0.12) inset; border-radius: 2px;
box-shadow: 0 0 0 1px rgba(144, 145, 148, 0.12) inset;
} }
th, td { th, td {
padding: .5em 1em; padding: 0.5em 1em;
box-shadow: 0 0 0 1px rgba(142, 142, 145, 0.12); box-shadow: 0 0 0 1px rgba(144, 145, 148, 0.12);
} }
tr:hover, tr:nth-child(odd) td { tr:hover, tr:nth-child(odd) td {
background: rgba(142, 142, 145, 0.04); background: rgba(144, 145, 148, 0.04);
} }
pre { pre {
background: rgba(40, 41, 48, 0.9)!important; background: rgba(144, 145, 148, 0.12);
color: #ffffff;
border-radius: 2px; border-radius: 2px;
font-size: .8em; font-size: 0.8em;
margin: 1.5em 0; margin: 1.5em 0;
padding: .8em 1.2em; padding: 0.8em 1.2em;
overflow-x: auto; overflow-x: auto;
} }
:not(pre) > code { :not(pre) > code {
font-size: .9em; font-size: 0.9em;
background: rgba(142, 142, 145, 0.15); background: rgba(144, 145, 148, 0.15);
opacity: .7; opacity: 0.7;
border-radius: 2px; border-radius: 2px;
margin: 0 .1em; margin: 0 0.1em;
padding: .2em .4em; padding: 0.2em 0.4em;
} }
body > header { body > header, body > footer {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: space-between;
align-items: center; align-items: center;
box-shadow: 0 0 0.6em rgba(28, 29, 34, 0.05); justify-content: space-between;
border-bottom: 1px solid rgba(142, 142, 145, 0.16); }
body > header, body > article, body > footer {
padding: 1.5em;
} }
article header { article header {
@ -132,39 +147,35 @@ article header {
article header h1 { article header h1 {
font-size: 1.7em; font-size: 1.7em;
margin: 0 0 .1em; margin: 0 0 0.1em;
} }
nav { nav {
margin: .5em -1em; margin: 0.5em -1em;
} }
nav a { nav a {
margin: .5em 1em; margin: 0.5em 1em;
} }
body > header, body > article { body > header {
padding: 1.5em; box-shadow: 0 0 .6em rgba(33, 34, 40 ,0.04);
border-bottom: 1px solid rgba(144, 145, 148, 0.14);
} }
@media (min-width: 32em) { body > footer {
body > header, body > article { box-shadow: 0 0 .6em rgba(33, 34, 40 ,0.04) inset;
padding: 1.7em calc(38% - 12em); border-top: 1px solid rgba(144, 145, 148, 0.14);
}
@media (min-width: 38em) {
body > header, body > article, body > footer {
padding: 1.7em calc(38% - 14em);
} }
} }
.title { .title {
font-size: 1.4em; font-size: 1.3em;
}
.archive {
font-size: 1.1em;
}
.archive time {
display: inline-block;
min-width: 10ch;
margin: 0 .2em;
} }
.more { .more {
@ -174,8 +185,8 @@ body > header, body > article {
.more a { .more a {
border-radius: 2px; border-radius: 2px;
border: 1.5px solid #68f; border: 1.5px solid #68f;
padding: .4em .8em; padding: 0.4em 0.8em;
transition: .2s background, .2s color; transition: 0.2s background, 0.2s color;
} }
.more a:hover { .more a:hover {
@ -183,3 +194,23 @@ body > header, body > article {
background: #68f; background: #68f;
text-decoration: inherit; text-decoration: inherit;
} }
.archive {
font-size: 1.1em;
}
.archive time {
display: inline-block;
min-width: 10ch;
margin: 0 0.2em;
}
.highlight pre {
background: rgba(47, 48, 57, 0.9)!important;
color: white!important;
}
.katex {
overflow-x: auto;
overflow-y: hidden;
}

View File

@ -1,11 +1,11 @@
# [<img src="https://katex.org/img/katex-logo-black.svg" width="130" alt="KaTeX">](https://katex.org/) # [<img src="https://katex.org/img/katex-logo-black.svg" width="130" alt="KaTeX">](https://katex.org/)
[![npm](https://img.shields.io/npm/v/katex.svg)](https://www.npmjs.com/package/katex) [![npm](https://img.shields.io/npm/v/katex.svg)](https://www.npmjs.com/package/katex)
[![CircleCI](https://circleci.com/gh/KaTeX/KaTeX.svg?style=shield)](https://circleci.com/gh/KaTeX/KaTeX) [![CI](https://github.com/KaTeX/KaTeX/workflows/CI/badge.svg?branch=master&event=push)](https://github.com/KaTeX/KaTeX/actions?query=workflow%3ACI)
[![codecov](https://codecov.io/gh/KaTeX/KaTeX/branch/master/graph/badge.svg)](https://codecov.io/gh/KaTeX/KaTeX) [![codecov](https://codecov.io/gh/KaTeX/KaTeX/branch/master/graph/badge.svg)](https://codecov.io/gh/KaTeX/KaTeX)
[![Join the chat at https://gitter.im/KaTeX/KaTeX](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/KaTeX/KaTeX?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Discussions](https://img.shields.io/badge/Discussions-join-brightgreen)](https://github.com/KaTeX/KaTeX/discussions)
[![Dependabot Status](https://api.dependabot.com/badges/status?host=github&repo=KaTeX/KaTeX)](https://dependabot.com)
[![jsDelivr](https://data.jsdelivr.com/v1/package/npm/katex/badge?style=rounded)](https://www.jsdelivr.com/package/npm/katex) [![jsDelivr](https://data.jsdelivr.com/v1/package/npm/katex/badge?style=rounded)](https://www.jsdelivr.com/package/npm/katex)
![](https://img.badgesize.io/KaTeX/KaTeX/v0.12.0/dist/katex.min.js?compression=gzip) ![katex.min.js size](https://img.badgesize.io/https://unpkg.com/katex/dist/katex.min.js?compression=gzip)
[![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/KaTeX/KaTeX)
KaTeX is a fast, easy-to-use JavaScript library for TeX math rendering on the web. KaTeX is a fast, easy-to-use JavaScript library for TeX math rendering on the web.
@ -29,13 +29,13 @@ Try out KaTeX [on the demo page](https://katex.org/#demo)!
<!-- KaTeX requires the use of the HTML5 doctype. Without it, KaTeX may not render properly --> <!-- KaTeX requires the use of the HTML5 doctype. Without it, KaTeX may not render properly -->
<html> <html>
<head> <head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.css" integrity="sha384-AfEj0r4/OFrOo5t7NnNe46zW/tFgW6x/bCJG8FqQCEo3+Aro6EYUG4+cU+KJWu/X" crossorigin="anonymous"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.0/dist/katex.min.css" integrity="sha384-t5CR+zwDAROtph0PXGte6ia8heboACF9R5l/DiY+WZ3P2lxNgvJkQk5n7GPvLMYw" crossorigin="anonymous">
<!-- The loading of KaTeX is deferred to speed up page rendering --> <!-- The loading of KaTeX is deferred to speed up page rendering -->
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.js" integrity="sha384-g7c+Jr9ZivxKLnZTDUhnkOnsh30B4H0rpLUpJ4jAIKs4fnJI+sEnkvrMWph2EDg4" crossorigin="anonymous"></script> <script defer src="https://cdn.jsdelivr.net/npm/katex@0.13.0/dist/katex.min.js" integrity="sha384-FaFLTlohFghEIZkw6VGwmf9ISTubWAVYW8tG8+w2LAIftJEULZABrF9PPFv+tVkH" crossorigin="anonymous"></script>
<!-- To automatically render math in text elements, include the auto-render extension: --> <!-- To automatically render math in text elements, include the auto-render extension: -->
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/contrib/auto-render.min.js" integrity="sha384-mll67QQFJfxn0IYznZYonOWZ644AWYC+Pt2cHqMaRhXVrursRwvLnLaebdGIlYNa" crossorigin="anonymous" <script defer src="https://cdn.jsdelivr.net/npm/katex@0.13.0/dist/contrib/auto-render.min.js" integrity="sha384-bHBqxz8fokvgoJ/sc17HODNxa42TlaEhB+w8ZJXTc2nZf1VgEaFZeZvT4Mznfz0v" crossorigin="anonymous"
onload="renderMathInElement(document.body);"></script> onload="renderMathInElement(document.body);"></script>
</head> </head>
... ...

View File

@ -7,111 +7,87 @@
exports["renderMathInElement"] = factory(require("katex")); exports["renderMathInElement"] = factory(require("katex"));
else else
root["renderMathInElement"] = factory(root["katex"]); root["renderMathInElement"] = factory(root["katex"]);
})((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__0__) { })((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__974__) {
return /******/ (function(modules) { // webpackBootstrap return /******/ (function() { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ 974:
/***/ (function(module) {
module.exports = __WEBPACK_EXTERNAL_MODULE__974__;
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache /******/ // The module cache
/******/ var installedModules = {}; /******/ var __webpack_module_cache__ = {};
/******/ /******/
/******/ // The require function /******/ // The require function
/******/ function __webpack_require__(moduleId) { /******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache /******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) { /******/ if(__webpack_module_cache__[moduleId]) {
/******/ return installedModules[moduleId].exports; /******/ return __webpack_module_cache__[moduleId].exports;
/******/ } /******/ }
/******/ // Create a new module (and put it into the cache) /******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = { /******/ var module = __webpack_module_cache__[moduleId] = {
/******/ i: moduleId, /******/ // no module.id needed
/******/ l: false, /******/ // no module.loaded needed
/******/ exports: {} /******/ exports: {}
/******/ }; /******/ };
/******/ /******/
/******/ // Execute the module function /******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/ /******/
/******/ // Return the exports of the module /******/ // Return the exports of the module
/******/ return module.exports; /******/ return module.exports;
/******/ } /******/ }
/******/ /******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 1);
/******/ })
/************************************************************************/ /************************************************************************/
/******/ ([ /******/ /* webpack/runtime/compat get default export */
/* 0 */ /******/ !function() {
/***/ (function(module, exports) { /******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function() { return module['default']; } :
/******/ function() { return module; };
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ }();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ !function() {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = function(exports, definition) {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ }();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ !function() {
/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
/******/ }();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
!function() {
module.exports = __WEBPACK_EXTERNAL_MODULE__0__; // EXPORTS
__webpack_require__.d(__webpack_exports__, {
/***/ }), "default": function() { return /* binding */ auto_render; }
/* 1 */ });
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
// EXTERNAL MODULE: external "katex" // EXTERNAL MODULE: external "katex"
var external_katex_ = __webpack_require__(0); var external_katex_ = __webpack_require__(974);
var external_katex_default = /*#__PURE__*/__webpack_require__.n(external_katex_); var external_katex_default = /*#__PURE__*/__webpack_require__.n(external_katex_);
;// CONCATENATED MODULE: ./contrib/auto-render/splitAtDelimiters.js
// CONCATENATED MODULE: ./contrib/auto-render/splitAtDelimiters.js
/* eslint no-constant-condition:0 */ /* eslint no-constant-condition:0 */
var findEndOfMath = function findEndOfMath(delimiter, text, startIndex) { var findEndOfMath = function findEndOfMath(delimiter, text, startIndex) {
// Adapted from // Adapted from
@ -139,96 +115,76 @@ var findEndOfMath = function findEndOfMath(delimiter, text, startIndex) {
return -1; return -1;
}; };
var splitAtDelimiters = function splitAtDelimiters(startData, leftDelim, rightDelim, display) { var escapeRegex = function escapeRegex(string) {
var finalData = []; return string.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
for (var i = 0; i < startData.length; i++) {
if (startData[i].type === "text") {
var text = startData[i].data;
var lookingForLeft = true;
var currIndex = 0;
var nextIndex = void 0;
nextIndex = text.indexOf(leftDelim);
if (nextIndex !== -1) {
currIndex = nextIndex;
finalData.push({
type: "text",
data: text.slice(0, currIndex)
});
lookingForLeft = false;
}
while (true) {
if (lookingForLeft) {
nextIndex = text.indexOf(leftDelim, currIndex);
if (nextIndex === -1) {
break;
}
finalData.push({
type: "text",
data: text.slice(currIndex, nextIndex)
});
currIndex = nextIndex;
} else {
nextIndex = findEndOfMath(rightDelim, text, currIndex + leftDelim.length);
if (nextIndex === -1) {
break;
}
finalData.push({
type: "math",
data: text.slice(currIndex + leftDelim.length, nextIndex),
rawData: text.slice(currIndex, nextIndex + rightDelim.length),
display: display
});
currIndex = nextIndex + rightDelim.length;
}
lookingForLeft = !lookingForLeft;
}
finalData.push({
type: "text",
data: text.slice(currIndex)
});
} else {
finalData.push(startData[i]);
}
}
return finalData;
}; };
/* harmony default export */ var auto_render_splitAtDelimiters = (splitAtDelimiters); var amsRegex = /^\\begin{/;
// CONCATENATED MODULE: ./contrib/auto-render/auto-render.js
/* eslint no-console:0 */ var splitAtDelimiters = function splitAtDelimiters(text, delimiters) {
var index;
var data = [];
var regexLeft = new RegExp("(" + delimiters.map(function (x) {
return escapeRegex(x.left);
}).join("|") + ")");
while (true) {
index = text.search(regexLeft);
if (index === -1) {
break;
}
if (index > 0) {
data.push({
type: "text",
data: text.slice(0, index)
});
text = text.slice(index); // now text starts with delimiter
} // ... so this always succeeds:
var i = delimiters.findIndex(function (delim) {
return text.startsWith(delim.left);
});
index = findEndOfMath(delimiters[i].right, text, delimiters[i].left.length);
var auto_render_splitWithDelimiters = function splitWithDelimiters(text, delimiters) { if (index === -1) {
var data = [{ break;
type: "text", }
data: text
}];
for (var i = 0; i < delimiters.length; i++) { var rawData = text.slice(0, index + delimiters[i].right.length);
var delimiter = delimiters[i]; var math = amsRegex.test(rawData) ? rawData : text.slice(delimiters[i].left.length, index);
data = auto_render_splitAtDelimiters(data, delimiter.left, delimiter.right, delimiter.display || false); data.push({
type: "math",
data: math,
rawData: rawData,
display: delimiters[i].display
});
text = text.slice(index + delimiters[i].right.length);
}
if (text !== "") {
data.push({
type: "text",
data: text
});
} }
return data; return data;
}; };
/* harmony default export */ var auto_render_splitAtDelimiters = (splitAtDelimiters);
;// CONCATENATED MODULE: ./contrib/auto-render/auto-render.js
/* eslint no-console:0 */
/* Note: optionsCopy is mutated by this method. If it is ever exposed in the /* Note: optionsCopy is mutated by this method. If it is ever exposed in the
* API, we should copy it before mutating. * API, we should copy it before mutating.
*/ */
var renderMathInText = function renderMathInText(text, optionsCopy) {
var auto_render_renderMathInText = function renderMathInText(text, optionsCopy) { var data = auto_render_splitAtDelimiters(text, optionsCopy.delimiters);
var data = auto_render_splitWithDelimiters(text, optionsCopy.delimiters);
if (data.length === 1 && data[0].type === 'text') { if (data.length === 1 && data[0].type === 'text') {
// There is no formula in the text. // There is no formula in the text.
@ -254,9 +210,9 @@ var auto_render_renderMathInText = function renderMathInText(text, optionsCopy)
math = optionsCopy.preProcess(math); math = optionsCopy.preProcess(math);
} }
external_katex_default.a.render(math, span, optionsCopy); external_katex_default().render(math, span, optionsCopy);
} catch (e) { } catch (e) {
if (!(e instanceof external_katex_default.a.ParseError)) { if (!(e instanceof (external_katex_default()).ParseError)) {
throw e; throw e;
} }
@ -278,7 +234,7 @@ var renderElem = function renderElem(elem, optionsCopy) {
if (childNode.nodeType === 3) { if (childNode.nodeType === 3) {
// Text node // Text node
var frag = auto_render_renderMathInText(childNode.textContent, optionsCopy); var frag = renderMathInText(childNode.textContent, optionsCopy);
if (frag) { if (frag) {
i += frag.childNodes.length - 1; i += frag.childNodes.length - 1;
@ -325,11 +281,29 @@ var renderMathInElement = function renderMathInElement(elem, options) {
display: false display: false
}, // LaTeX uses $…$, but it ruins the display of normal `$` in text: }, // LaTeX uses $…$, but it ruins the display of normal `$` in text:
// {left: "$", right: "$", display: false}, // {left: "$", right: "$", display: false},
// \[…\] must come last in this array. Otherwise, renderMathInElement // $ must come after $$
// will search for \[ before it searches for $$ or \( // Render AMS environments even if outside $$…$$ delimiters.
// That makes it susceptible to finding a \\[0.3em] row delimiter and
// treating it as if it were the start of a KaTeX math zone.
{ {
left: "\\begin{equation}",
right: "\\end{equation}",
display: true
}, {
left: "\\begin{align}",
right: "\\end{align}",
display: true
}, {
left: "\\begin{alignat}",
right: "\\end{alignat}",
display: true
}, {
left: "\\begin{gather}",
right: "\\end{gather}",
display: true
}, {
left: "\\begin{CD}",
right: "\\end{CD}",
display: true
}, {
left: "\\[", left: "\\[",
right: "\\]", right: "\\]",
display: true display: true
@ -343,8 +317,10 @@ var renderMathInElement = function renderMathInElement(elem, options) {
renderElem(elem, optionsCopy); renderElem(elem, optionsCopy);
}; };
/* harmony default export */ var auto_render = __webpack_exports__["default"] = (renderMathInElement); /* harmony default export */ var auto_render = (renderMathInElement);
}();
/***/ }) __webpack_exports__ = __webpack_exports__.default;
/******/ ])["default"]; /******/ return __webpack_exports__;
/******/ })()
;
}); });

View File

@ -1 +1 @@
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("katex")):"function"==typeof define&&define.amd?define(["katex"],t):"object"==typeof exports?exports.renderMathInElement=t(require("katex")):e.renderMathInElement=t(e.katex)}("undefined"!=typeof self?self:this,function(e){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1)}([function(t,r){t.exports=e},function(e,t,r){"use strict";r.r(t);var n=r(0),o=r.n(n),a=function(e,t,r){for(var n=r,o=0,a=e.length;n<t.length;){var i=t[n];if(o<=0&&t.slice(n,n+a)===e)return n;"\\"===i?n++:"{"===i?o++:"}"===i&&o--,n++}return-1},i=function(e,t,r,n){for(var o=[],i=0;i<e.length;i++)if("text"===e[i].type){var l=e[i].data,d=!0,s=0,f=void 0;for(-1!==(f=l.indexOf(t))&&(s=f,o.push({type:"text",data:l.slice(0,s)}),d=!1);;){if(d){if(-1===(f=l.indexOf(t,s)))break;o.push({type:"text",data:l.slice(s,f)}),s=f}else{if(-1===(f=a(r,l,s+t.length)))break;o.push({type:"math",data:l.slice(s+t.length,f),rawData:l.slice(s,f+r.length),display:n}),s=f+r.length}d=!d}o.push({type:"text",data:l.slice(s)})}else o.push(e[i]);return o},l=function(e,t){var r=function(e,t){for(var r=[{type:"text",data:e}],n=0;n<t.length;n++){var o=t[n];r=i(r,o.left,o.right,o.display||!1)}return r}(e,t.delimiters);if(1===r.length&&"text"===r[0].type)return null;for(var n=document.createDocumentFragment(),a=0;a<r.length;a++)if("text"===r[a].type)n.appendChild(document.createTextNode(r[a].data));else{var l=document.createElement("span"),d=r[a].data;t.displayMode=r[a].display;try{t.preProcess&&(d=t.preProcess(d)),o.a.render(d,l,t)}catch(e){if(!(e instanceof o.a.ParseError))throw e;t.errorCallback("KaTeX auto-render: Failed to parse `"+r[a].data+"` with ",e),n.appendChild(document.createTextNode(r[a].rawData));continue}n.appendChild(l)}return n};t.default=function(e,t){if(!e)throw new Error("No element provided to render");var r={};for(var n in t)t.hasOwnProperty(n)&&(r[n]=t[n]);r.delimiters=r.delimiters||[{left:"$$",right:"$$",display:!0},{left:"\\(",right:"\\)",display:!1},{left:"\\[",right:"\\]",display:!0}],r.ignoredTags=r.ignoredTags||["script","noscript","style","textarea","pre","code","option"],r.ignoredClasses=r.ignoredClasses||[],r.errorCallback=r.errorCallback||console.error,r.macros=r.macros||{},function e(t,r){for(var n=0;n<t.childNodes.length;n++){var o=t.childNodes[n];if(3===o.nodeType){var a=l(o.textContent,r);a&&(n+=a.childNodes.length-1,t.replaceChild(a,o))}else 1===o.nodeType&&function(){var t=" "+o.className+" ";-1===r.ignoredTags.indexOf(o.nodeName.toLowerCase())&&r.ignoredClasses.every(function(e){return-1===t.indexOf(" "+e+" ")})&&e(o,r)}()}}(e,r)}}]).default}); !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("katex")):"function"==typeof define&&define.amd?define(["katex"],t):"object"==typeof exports?exports.renderMathInElement=t(require("katex")):e.renderMathInElement=t(e.katex)}("undefined"!=typeof self?self:this,(function(e){return function(){"use strict";var t={974:function(t){t.exports=e}},r={};function n(e){if(r[e])return r[e].exports;var a=r[e]={exports:{}};return t[e](a,a.exports,n),a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var a={};return function(){n.d(a,{default:function(){return s}});var e=n(974),t=n.n(e),r=function(e,t,r){for(var n=r,a=0,i=e.length;n<t.length;){var o=t[n];if(a<=0&&t.slice(n,n+i)===e)return n;"\\"===o?n++:"{"===o?a++:"}"===o&&a--,n++}return-1},i=/^\\begin{/,o=function(e,t){for(var n,a=[],o=new RegExp("("+t.map((function(e){return e.left.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")})).join("|")+")");-1!==(n=e.search(o));){n>0&&(a.push({type:"text",data:e.slice(0,n)}),e=e.slice(n));var l=t.findIndex((function(t){return e.startsWith(t.left)}));if(-1===(n=r(t[l].right,e,t[l].left.length)))break;var d=e.slice(0,n+t[l].right.length),s=i.test(d)?d:e.slice(t[l].left.length,n);a.push({type:"math",data:s,rawData:d,display:t[l].display}),e=e.slice(n+t[l].right.length)}return""!==e&&a.push({type:"text",data:e}),a},l=function(e,r){var n=o(e,r.delimiters);if(1===n.length&&"text"===n[0].type)return null;for(var a=document.createDocumentFragment(),i=0;i<n.length;i++)if("text"===n[i].type)a.appendChild(document.createTextNode(n[i].data));else{var l=document.createElement("span"),d=n[i].data;r.displayMode=n[i].display;try{r.preProcess&&(d=r.preProcess(d)),t().render(d,l,r)}catch(e){if(!(e instanceof t().ParseError))throw e;r.errorCallback("KaTeX auto-render: Failed to parse `"+n[i].data+"` with ",e),a.appendChild(document.createTextNode(n[i].rawData));continue}a.appendChild(l)}return a},d=function e(t,r){for(var n=0;n<t.childNodes.length;n++){var a=t.childNodes[n];if(3===a.nodeType){var i=l(a.textContent,r);i&&(n+=i.childNodes.length-1,t.replaceChild(i,a))}else 1===a.nodeType&&function(){var t=" "+a.className+" ";-1===r.ignoredTags.indexOf(a.nodeName.toLowerCase())&&r.ignoredClasses.every((function(e){return-1===t.indexOf(" "+e+" ")}))&&e(a,r)}()}},s=function(e,t){if(!e)throw new Error("No element provided to render");var r={};for(var n in t)t.hasOwnProperty(n)&&(r[n]=t[n]);r.delimiters=r.delimiters||[{left:"$$",right:"$$",display:!0},{left:"\\(",right:"\\)",display:!1},{left:"\\begin{equation}",right:"\\end{equation}",display:!0},{left:"\\begin{align}",right:"\\end{align}",display:!0},{left:"\\begin{alignat}",right:"\\end{alignat}",display:!0},{left:"\\begin{gather}",right:"\\end{gather}",display:!0},{left:"\\begin{CD}",right:"\\end{CD}",display:!0},{left:"\\[",right:"\\]",display:!0}],r.ignoredTags=r.ignoredTags||["script","noscript","style","textarea","pre","code","option"],r.ignoredClasses=r.ignoredClasses||[],r.errorCallback=r.errorCallback||console.error,r.macros=r.macros||{},d(e,r)}}(),a=a.default}()}));

View File

@ -1,15 +1,15 @@
import katex from '../katex.mjs'; import katex from '../katex.mjs';
/* eslint no-constant-condition:0 */ /* eslint no-constant-condition:0 */
const findEndOfMath = function findEndOfMath(delimiter, text, startIndex) { var findEndOfMath = function findEndOfMath(delimiter, text, startIndex) {
// Adapted from // Adapted from
// https://github.com/Khan/perseus/blob/master/src/perseus-markdown.jsx // https://github.com/Khan/perseus/blob/master/src/perseus-markdown.jsx
let index = startIndex; var index = startIndex;
let braceLevel = 0; var braceLevel = 0;
const delimLength = delimiter.length; var delimLength = delimiter.length;
while (index < text.length) { while (index < text.length) {
const character = text[index]; var character = text[index];
if (braceLevel <= 0 && text.slice(index, index + delimLength) === delimiter) { if (braceLevel <= 0 && text.slice(index, index + delimLength) === delimiter) {
return index; return index;
@ -27,92 +27,68 @@ const findEndOfMath = function findEndOfMath(delimiter, text, startIndex) {
return -1; return -1;
}; };
const splitAtDelimiters = function splitAtDelimiters(startData, leftDelim, rightDelim, display) { var escapeRegex = function escapeRegex(string) {
const finalData = []; return string.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
for (let i = 0; i < startData.length; i++) {
if (startData[i].type === "text") {
const text = startData[i].data;
let lookingForLeft = true;
let currIndex = 0;
let nextIndex;
nextIndex = text.indexOf(leftDelim);
if (nextIndex !== -1) {
currIndex = nextIndex;
finalData.push({
type: "text",
data: text.slice(0, currIndex)
});
lookingForLeft = false;
}
while (true) {
if (lookingForLeft) {
nextIndex = text.indexOf(leftDelim, currIndex);
if (nextIndex === -1) {
break;
}
finalData.push({
type: "text",
data: text.slice(currIndex, nextIndex)
});
currIndex = nextIndex;
} else {
nextIndex = findEndOfMath(rightDelim, text, currIndex + leftDelim.length);
if (nextIndex === -1) {
break;
}
finalData.push({
type: "math",
data: text.slice(currIndex + leftDelim.length, nextIndex),
rawData: text.slice(currIndex, nextIndex + rightDelim.length),
display: display
});
currIndex = nextIndex + rightDelim.length;
}
lookingForLeft = !lookingForLeft;
}
finalData.push({
type: "text",
data: text.slice(currIndex)
});
} else {
finalData.push(startData[i]);
}
}
return finalData;
}; };
/* eslint no-console:0 */ var amsRegex = /^\\begin{/;
const splitWithDelimiters = function splitWithDelimiters(text, delimiters) { var splitAtDelimiters = function splitAtDelimiters(text, delimiters) {
let data = [{ var index;
type: "text", var data = [];
data: text var regexLeft = new RegExp("(" + delimiters.map(x => escapeRegex(x.left)).join("|") + ")");
}];
for (let i = 0; i < delimiters.length; i++) { while (true) {
const delimiter = delimiters[i]; index = text.search(regexLeft);
data = splitAtDelimiters(data, delimiter.left, delimiter.right, delimiter.display || false);
if (index === -1) {
break;
}
if (index > 0) {
data.push({
type: "text",
data: text.slice(0, index)
});
text = text.slice(index); // now text starts with delimiter
} // ... so this always succeeds:
var i = delimiters.findIndex(delim => text.startsWith(delim.left));
index = findEndOfMath(delimiters[i].right, text, delimiters[i].left.length);
if (index === -1) {
break;
}
var rawData = text.slice(0, index + delimiters[i].right.length);
var math = amsRegex.test(rawData) ? rawData : text.slice(delimiters[i].left.length, index);
data.push({
type: "math",
data: math,
rawData,
display: delimiters[i].display
});
text = text.slice(index + delimiters[i].right.length);
}
if (text !== "") {
data.push({
type: "text",
data: text
});
} }
return data; return data;
}; };
/* eslint no-console:0 */
/* Note: optionsCopy is mutated by this method. If it is ever exposed in the /* Note: optionsCopy is mutated by this method. If it is ever exposed in the
* API, we should copy it before mutating. * API, we should copy it before mutating.
*/ */
var renderMathInText = function renderMathInText(text, optionsCopy) {
const renderMathInText = function renderMathInText(text, optionsCopy) { var data = splitAtDelimiters(text, optionsCopy.delimiters);
const data = splitWithDelimiters(text, optionsCopy.delimiters);
if (data.length === 1 && data[0].type === 'text') { if (data.length === 1 && data[0].type === 'text') {
// There is no formula in the text. // There is no formula in the text.
@ -121,14 +97,14 @@ const renderMathInText = function renderMathInText(text, optionsCopy) {
return null; return null;
} }
const fragment = document.createDocumentFragment(); var fragment = document.createDocumentFragment();
for (let i = 0; i < data.length; i++) { for (var i = 0; i < data.length; i++) {
if (data[i].type === "text") { if (data[i].type === "text") {
fragment.appendChild(document.createTextNode(data[i].data)); fragment.appendChild(document.createTextNode(data[i].data));
} else { } else {
const span = document.createElement("span"); var span = document.createElement("span");
let math = data[i].data; // Override any display mode defined in the settings with that var math = data[i].data; // Override any display mode defined in the settings with that
// defined by the text itself // defined by the text itself
optionsCopy.displayMode = data[i].display; optionsCopy.displayMode = data[i].display;
@ -156,39 +132,41 @@ const renderMathInText = function renderMathInText(text, optionsCopy) {
return fragment; return fragment;
}; };
const renderElem = function renderElem(elem, optionsCopy) { var renderElem = function renderElem(elem, optionsCopy) {
for (let i = 0; i < elem.childNodes.length; i++) { for (var i = 0; i < elem.childNodes.length; i++) {
const childNode = elem.childNodes[i]; var childNode = elem.childNodes[i];
if (childNode.nodeType === 3) { if (childNode.nodeType === 3) {
// Text node // Text node
const frag = renderMathInText(childNode.textContent, optionsCopy); var frag = renderMathInText(childNode.textContent, optionsCopy);
if (frag) { if (frag) {
i += frag.childNodes.length - 1; i += frag.childNodes.length - 1;
elem.replaceChild(frag, childNode); elem.replaceChild(frag, childNode);
} }
} else if (childNode.nodeType === 1) { } else if (childNode.nodeType === 1) {
// Element node (function () {
const className = ' ' + childNode.className + ' '; // Element node
const shouldRender = optionsCopy.ignoredTags.indexOf(childNode.nodeName.toLowerCase()) === -1 && optionsCopy.ignoredClasses.every(x => className.indexOf(' ' + x + ' ') === -1); var className = ' ' + childNode.className + ' ';
var shouldRender = optionsCopy.ignoredTags.indexOf(childNode.nodeName.toLowerCase()) === -1 && optionsCopy.ignoredClasses.every(x => className.indexOf(' ' + x + ' ') === -1);
if (shouldRender) { if (shouldRender) {
renderElem(childNode, optionsCopy); renderElem(childNode, optionsCopy);
} }
})();
} // Otherwise, it's something else, and ignore it. } // Otherwise, it's something else, and ignore it.
} }
}; };
const renderMathInElement = function renderMathInElement(elem, options) { var renderMathInElement = function renderMathInElement(elem, options) {
if (!elem) { if (!elem) {
throw new Error("No element provided to render"); throw new Error("No element provided to render");
} }
const optionsCopy = {}; // Object.assign(optionsCopy, option) var optionsCopy = {}; // Object.assign(optionsCopy, option)
for (const option in options) { for (var option in options) {
if (options.hasOwnProperty(option)) { if (options.hasOwnProperty(option)) {
optionsCopy[option] = options[option]; optionsCopy[option] = options[option];
} }
@ -205,11 +183,29 @@ const renderMathInElement = function renderMathInElement(elem, options) {
display: false display: false
}, // LaTeX uses $…$, but it ruins the display of normal `$` in text: }, // LaTeX uses $…$, but it ruins the display of normal `$` in text:
// {left: "$", right: "$", display: false}, // {left: "$", right: "$", display: false},
// \[…\] must come last in this array. Otherwise, renderMathInElement // $ must come after $$
// will search for \[ before it searches for $$ or \( // Render AMS environments even if outside $$…$$ delimiters.
// That makes it susceptible to finding a \\[0.3em] row delimiter and
// treating it as if it were the start of a KaTeX math zone.
{ {
left: "\\begin{equation}",
right: "\\end{equation}",
display: true
}, {
left: "\\begin{align}",
right: "\\end{align}",
display: true
}, {
left: "\\begin{alignat}",
right: "\\end{alignat}",
display: true
}, {
left: "\\begin{gather}",
right: "\\end{gather}",
display: true
}, {
left: "\\begin{CD}",
right: "\\end{CD}",
display: true
}, {
left: "\\[", left: "\\[",
right: "\\]", right: "\\]",
display: true display: true

View File

@ -6,9 +6,9 @@
*/ */
.katex, .katex,
.katex-display { .katex-display {
user-select: all;
-moz-user-select: all;
-webkit-user-select: all; -webkit-user-select: all;
-ms-user-select: all; -moz-user-select: all;
-ms-user-select: all;
user-select: all;
} }

View File

@ -8,109 +8,11 @@
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
} }
})((typeof self !== 'undefined' ? self : this), function() { })((typeof self !== 'undefined' ? self : this), function() {
return /******/ (function(modules) { // webpackBootstrap return /******/ (function() { // webpackBootstrap
/******/ // The module cache /******/ "use strict";
/******/ var installedModules = {}; var __webpack_exports__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 1);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
// extracted by mini-css-extract-plugin ;// CONCATENATED MODULE: ./contrib/copy-tex/katex2tex.js
/***/ }),
/* 1 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
// EXTERNAL MODULE: ./contrib/copy-tex/copy-tex.css
var copy_tex = __webpack_require__(0);
// CONCATENATED MODULE: ./contrib/copy-tex/katex2tex.js
// Set these to how you want inline and display math to be delimited. // Set these to how you want inline and display math to be delimited.
var defaultCopyDelimiters = { var defaultCopyDelimiters = {
inline: ['$', '$'], inline: ['$', '$'],
@ -171,7 +73,7 @@ var katexReplaceWithTex = function katexReplaceWithTex(fragment, copyDelimiters)
return fragment; return fragment;
}; };
/* harmony default export */ var katex2tex = (katexReplaceWithTex); /* harmony default export */ var katex2tex = (katexReplaceWithTex);
// CONCATENATED MODULE: ./contrib/copy-tex/copy-tex.js ;// CONCATENATED MODULE: ./contrib/copy-tex/copy-tex.js
// Global copy handler to modify behavior on .katex elements. // Global copy handler to modify behavior on .katex elements.
document.addEventListener('copy', function (event) { document.addEventListener('copy', function (event) {
@ -200,14 +102,15 @@ document.addEventListener('copy', function (event) {
event.preventDefault(); event.preventDefault();
}); });
// CONCATENATED MODULE: ./contrib/copy-tex/copy-tex.webpack.js ;// CONCATENATED MODULE: ./contrib/copy-tex/copy-tex.webpack.js
/** /**
* This is the webpack entry point for KaTeX. As ECMAScript doesn't support * This is the webpack entry point for KaTeX. As ECMAScript doesn't support
* CSS modules natively, a separate entry point is used. * CSS modules natively, a separate entry point is used.
*/ */
__webpack_exports__ = __webpack_exports__.default;
/***/ }) /******/ return __webpack_exports__;
/******/ ])["default"]; /******/ })()
;
}); });

View File

@ -1 +1 @@
.katex,.katex-display{user-select:all;-moz-user-select:all;-webkit-user-select:all;-ms-user-select:all} .katex,.katex-display{-webkit-user-select:all;-moz-user-select:all;-ms-user-select:all;user-select:all}

View File

@ -1 +1 @@
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}("undefined"!=typeof self?self:this,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t,n){},function(e,t,n){"use strict";n.r(t);n(0);var r={inline:["$","$"],display:["$$","$$"]},o=function(e,t){void 0===t&&(t=r);for(var n=e.querySelectorAll(".katex-mathml + .katex-html"),o=0;o<n.length;o++){var l=n[o];l.remove?l.remove(null):l.parentNode.removeChild(l)}for(var i=e.querySelectorAll(".katex-mathml"),a=0;a<i.length;a++){var u=i[a],f=u.querySelector("annotation");f&&(u.replaceWith?u.replaceWith(f):u.parentNode.replaceChild(f,u),f.innerHTML=t.inline[0]+f.innerHTML+t.inline[1])}for(var c=e.querySelectorAll(".katex-display annotation"),d=0;d<c.length;d++){var p=c[d];p.innerHTML=t.display[0]+p.innerHTML.substr(t.inline[0].length,p.innerHTML.length-t.inline[0].length-t.inline[1].length)+t.display[1]}return e};document.addEventListener("copy",function(e){var t=window.getSelection();if(!t.isCollapsed){var n=t.getRangeAt(0).cloneContents();if(n.querySelector(".katex-mathml")){for(var r=[],l=0;l<n.childNodes.length;l++)r.push(n.childNodes[l].outerHTML);e.clipboardData.setData("text/html",r.join("")),e.clipboardData.setData("text/plain",o(n).textContent),e.preventDefault()}}})}]).default}); !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var l in n)("object"==typeof exports?exports:e)[l]=n[l]}}("undefined"!=typeof self?self:this,(function(){return function(){"use strict";var e={},t={inline:["$","$"],display:["$$","$$"]},n=function(e,n){void 0===n&&(n=t);for(var l=e.querySelectorAll(".katex-mathml + .katex-html"),r=0;r<l.length;r++){var i=l[r];i.remove?i.remove(null):i.parentNode.removeChild(i)}for(var o=e.querySelectorAll(".katex-mathml"),a=0;a<o.length;a++){var d=o[a],f=d.querySelector("annotation");f&&(d.replaceWith?d.replaceWith(f):d.parentNode.replaceChild(f,d),f.innerHTML=n.inline[0]+f.innerHTML+n.inline[1])}for(var c=e.querySelectorAll(".katex-display annotation"),s=0;s<c.length;s++){var p=c[s];p.innerHTML=n.display[0]+p.innerHTML.substr(n.inline[0].length,p.innerHTML.length-n.inline[0].length-n.inline[1].length)+n.display[1]}return e};return document.addEventListener("copy",(function(e){var t=window.getSelection();if(!t.isCollapsed){var l=t.getRangeAt(0).cloneContents();if(l.querySelector(".katex-mathml")){for(var r=[],i=0;i<l.childNodes.length;i++)r.push(l.childNodes[i].outerHTML);e.clipboardData.setData("text/html",r.join("")),e.clipboardData.setData("text/plain",n(l).textContent),e.preventDefault()}}})),e=e.default}()}));

View File

@ -1,5 +1,5 @@
// Set these to how you want inline and display math to be delimited. // Set these to how you want inline and display math to be delimited.
const defaultCopyDelimiters = { var defaultCopyDelimiters = {
inline: ['$', '$'], inline: ['$', '$'],
// alternative: ['\(', '\)'] // alternative: ['\(', '\)']
display: ['$$', '$$'] // alternative: ['\[', '\]'] display: ['$$', '$$'] // alternative: ['\[', '\]']
@ -8,17 +8,17 @@ const defaultCopyDelimiters = {
// Modifies fragment in-place. Useful for writing your own 'copy' handler, // Modifies fragment in-place. Useful for writing your own 'copy' handler,
// as in copy-tex.js. // as in copy-tex.js.
const katexReplaceWithTex = function katexReplaceWithTex(fragment, copyDelimiters) { var katexReplaceWithTex = function katexReplaceWithTex(fragment, copyDelimiters) {
if (copyDelimiters === void 0) { if (copyDelimiters === void 0) {
copyDelimiters = defaultCopyDelimiters; copyDelimiters = defaultCopyDelimiters;
} }
// Remove .katex-html blocks that are preceded by .katex-mathml blocks // Remove .katex-html blocks that are preceded by .katex-mathml blocks
// (which will get replaced below). // (which will get replaced below).
const katexHtml = fragment.querySelectorAll('.katex-mathml + .katex-html'); var katexHtml = fragment.querySelectorAll('.katex-mathml + .katex-html');
for (let i = 0; i < katexHtml.length; i++) { for (var i = 0; i < katexHtml.length; i++) {
const element = katexHtml[i]; var element = katexHtml[i];
if (element.remove) { if (element.remove) {
element.remove(null); element.remove(null);
@ -29,17 +29,18 @@ const katexReplaceWithTex = function katexReplaceWithTex(fragment, copyDelimiter
// descendant, with inline delimiters. // descendant, with inline delimiters.
const katexMathml = fragment.querySelectorAll('.katex-mathml'); var katexMathml = fragment.querySelectorAll('.katex-mathml');
for (let i = 0; i < katexMathml.length; i++) { for (var _i = 0; _i < katexMathml.length; _i++) {
const element = katexMathml[i]; var _element = katexMathml[_i];
const texSource = element.querySelector('annotation');
var texSource = _element.querySelector('annotation');
if (texSource) { if (texSource) {
if (element.replaceWith) { if (_element.replaceWith) {
element.replaceWith(texSource); _element.replaceWith(texSource);
} else { } else {
element.parentNode.replaceChild(texSource, element); _element.parentNode.replaceChild(texSource, _element);
} }
texSource.innerHTML = copyDelimiters.inline[0] + texSource.innerHTML + copyDelimiters.inline[1]; texSource.innerHTML = copyDelimiters.inline[0] + texSource.innerHTML + copyDelimiters.inline[1];
@ -47,33 +48,33 @@ const katexReplaceWithTex = function katexReplaceWithTex(fragment, copyDelimiter
} // Switch display math to display delimiters. } // Switch display math to display delimiters.
const displays = fragment.querySelectorAll('.katex-display annotation'); var displays = fragment.querySelectorAll('.katex-display annotation');
for (let i = 0; i < displays.length; i++) { for (var _i2 = 0; _i2 < displays.length; _i2++) {
const element = displays[i]; var _element2 = displays[_i2];
element.innerHTML = copyDelimiters.display[0] + element.innerHTML.substr(copyDelimiters.inline[0].length, element.innerHTML.length - copyDelimiters.inline[0].length - copyDelimiters.inline[1].length) + copyDelimiters.display[1]; _element2.innerHTML = copyDelimiters.display[0] + _element2.innerHTML.substr(copyDelimiters.inline[0].length, _element2.innerHTML.length - copyDelimiters.inline[0].length - copyDelimiters.inline[1].length) + copyDelimiters.display[1];
} }
return fragment; return fragment;
}; };
document.addEventListener('copy', function (event) { document.addEventListener('copy', function (event) {
const selection = window.getSelection(); var selection = window.getSelection();
if (selection.isCollapsed) { if (selection.isCollapsed) {
return; // default action OK if selection is empty return; // default action OK if selection is empty
} }
const fragment = selection.getRangeAt(0).cloneContents(); var fragment = selection.getRangeAt(0).cloneContents();
if (!fragment.querySelector('.katex-mathml')) { if (!fragment.querySelector('.katex-mathml')) {
return; // default action OK if no .katex-mathml elements return; // default action OK if no .katex-mathml elements
} // Preserve usual HTML copy/paste behavior. } // Preserve usual HTML copy/paste behavior.
const html = []; var html = [];
for (let i = 0; i < fragment.childNodes.length; i++) { for (var i = 0; i < fragment.childNodes.length; i++) {
html.push(fragment.childNodes[i].outerHTML); html.push(fragment.childNodes[i].outerHTML);
} }

View File

@ -7,106 +7,78 @@
var a = typeof exports === 'object' ? factory(require("katex")) : factory(root["katex"]); var a = typeof exports === 'object' ? factory(require("katex")) : factory(root["katex"]);
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
} }
})((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__0__) { })((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__974__) {
return /******/ (function(modules) { // webpackBootstrap return /******/ (function() { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ 974:
/***/ (function(module) {
module.exports = __WEBPACK_EXTERNAL_MODULE__974__;
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache /******/ // The module cache
/******/ var installedModules = {}; /******/ var __webpack_module_cache__ = {};
/******/ /******/
/******/ // The require function /******/ // The require function
/******/ function __webpack_require__(moduleId) { /******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache /******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) { /******/ if(__webpack_module_cache__[moduleId]) {
/******/ return installedModules[moduleId].exports; /******/ return __webpack_module_cache__[moduleId].exports;
/******/ } /******/ }
/******/ // Create a new module (and put it into the cache) /******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = { /******/ var module = __webpack_module_cache__[moduleId] = {
/******/ i: moduleId, /******/ // no module.id needed
/******/ l: false, /******/ // no module.loaded needed
/******/ exports: {} /******/ exports: {}
/******/ }; /******/ };
/******/ /******/
/******/ // Execute the module function /******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/ /******/
/******/ // Return the exports of the module /******/ // Return the exports of the module
/******/ return module.exports; /******/ return module.exports;
/******/ } /******/ }
/******/ /******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 1);
/******/ })
/************************************************************************/ /************************************************************************/
/******/ ([ /******/ /* webpack/runtime/compat get default export */
/* 0 */ /******/ !function() {
/***/ (function(module, exports) { /******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
module.exports = __WEBPACK_EXTERNAL_MODULE__0__; /******/ var getter = module && module.__esModule ?
/******/ function() { return module['default']; } :
/***/ }), /******/ function() { return module; };
/* 1 */ /******/ __webpack_require__.d(getter, { a: getter });
/***/ (function(module, __webpack_exports__, __webpack_require__) { /******/ return getter;
/******/ };
"use strict"; /******/ }();
__webpack_require__.r(__webpack_exports__); /******/
/* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); /******/ /* webpack/runtime/define property getters */
/******/ !function() {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = function(exports, definition) {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ }();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ !function() {
/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
/******/ }();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
!function() {
/* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(974);
/* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(katex__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(katex__WEBPACK_IMPORTED_MODULE_0__);
var scripts = document.body.getElementsByTagName("script"); var scripts = document.body.getElementsByTagName("script");
@ -121,7 +93,7 @@ scripts.forEach(function (script) {
katexElement.setAttribute("class", display ? "equation" : "inline-equation"); katexElement.setAttribute("class", display ? "equation" : "inline-equation");
try { try {
katex__WEBPACK_IMPORTED_MODULE_0___default.a.render(script.text, katexElement, { katex__WEBPACK_IMPORTED_MODULE_0___default().render(script.text, katexElement, {
displayMode: display displayMode: display
}); });
} catch (err) { } catch (err) {
@ -131,7 +103,9 @@ scripts.forEach(function (script) {
script.parentNode.replaceChild(katexElement, script); script.parentNode.replaceChild(katexElement, script);
}); });
}();
/***/ }) __webpack_exports__ = __webpack_exports__.default;
/******/ ])["default"]; /******/ return __webpack_exports__;
/******/ })()
;
}); });

View File

@ -1 +1 @@
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("katex"));else if("function"==typeof define&&define.amd)define(["katex"],t);else{var r="object"==typeof exports?t(require("katex")):t(e.katex);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}("undefined"!=typeof self?self:this,function(e){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1)}([function(t,r){t.exports=e},function(e,t,r){"use strict";r.r(t);var n=r(0),o=r.n(n),u=document.body.getElementsByTagName("script");(u=Array.prototype.slice.call(u)).forEach(function(e){if(!e.type||!e.type.match(/math\/tex/i))return-1;var t=null!=e.type.match(/mode\s*=\s*display(;|\s|\n|$)/),r=document.createElement(t?"div":"span");r.setAttribute("class",t?"equation":"inline-equation");try{o.a.render(e.text,r,{displayMode:t})}catch(t){r.textContent=e.text}e.parentNode.replaceChild(r,e)})}]).default}); !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("katex"));else if("function"==typeof define&&define.amd)define(["katex"],t);else{var r="object"==typeof exports?t(require("katex")):t(e.katex);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}("undefined"!=typeof self?self:this,(function(e){return function(){"use strict";var t={974:function(t){t.exports=e}},r={};function n(e){if(r[e])return r[e].exports;var o=r[e]={exports:{}};return t[e](o,o.exports,n),o.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var o,i,a,u={};return o=n(974),i=n.n(o),a=document.body.getElementsByTagName("script"),(a=Array.prototype.slice.call(a)).forEach((function(e){if(!e.type||!e.type.match(/math\/tex/i))return-1;var t=null!=e.type.match(/mode\s*=\s*display(;|\s|\n|$)/),r=document.createElement(t?"div":"span");r.setAttribute("class",t?"equation":"inline-equation");try{i().render(e.text,r,{displayMode:t})}catch(t){r.textContent=e.text}e.parentNode.replaceChild(r,e)})),u=u.default}()}));

View File

@ -1,14 +1,14 @@
import katex from '../katex.mjs'; import katex from '../katex.mjs';
let scripts = document.body.getElementsByTagName("script"); var scripts = document.body.getElementsByTagName("script");
scripts = Array.prototype.slice.call(scripts); scripts = Array.prototype.slice.call(scripts);
scripts.forEach(function (script) { scripts.forEach(function (script) {
if (!script.type || !script.type.match(/math\/tex/i)) { if (!script.type || !script.type.match(/math\/tex/i)) {
return -1; return -1;
} }
const display = script.type.match(/mode\s*=\s*display(;|\s|\n|$)/) != null; var display = script.type.match(/mode\s*=\s*display(;|\s|\n|$)/) != null;
const katexElement = document.createElement(display ? "div" : "span"); var katexElement = document.createElement(display ? "div" : "span");
katexElement.setAttribute("class", display ? "equation" : "inline-equation"); katexElement.setAttribute("class", display ? "equation" : "inline-equation");
try { try {

View File

@ -7,106 +7,78 @@
var a = typeof exports === 'object' ? factory(require("katex")) : factory(root["katex"]); var a = typeof exports === 'object' ? factory(require("katex")) : factory(root["katex"]);
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
} }
})((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__0__) { })((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__974__) {
return /******/ (function(modules) { // webpackBootstrap return /******/ (function() { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ 974:
/***/ (function(module) {
module.exports = __WEBPACK_EXTERNAL_MODULE__974__;
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache /******/ // The module cache
/******/ var installedModules = {}; /******/ var __webpack_module_cache__ = {};
/******/ /******/
/******/ // The require function /******/ // The require function
/******/ function __webpack_require__(moduleId) { /******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache /******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) { /******/ if(__webpack_module_cache__[moduleId]) {
/******/ return installedModules[moduleId].exports; /******/ return __webpack_module_cache__[moduleId].exports;
/******/ } /******/ }
/******/ // Create a new module (and put it into the cache) /******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = { /******/ var module = __webpack_module_cache__[moduleId] = {
/******/ i: moduleId, /******/ // no module.id needed
/******/ l: false, /******/ // no module.loaded needed
/******/ exports: {} /******/ exports: {}
/******/ }; /******/ };
/******/ /******/
/******/ // Execute the module function /******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/ /******/
/******/ // Return the exports of the module /******/ // Return the exports of the module
/******/ return module.exports; /******/ return module.exports;
/******/ } /******/ }
/******/ /******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 1);
/******/ })
/************************************************************************/ /************************************************************************/
/******/ ([ /******/ /* webpack/runtime/compat get default export */
/* 0 */ /******/ !function() {
/***/ (function(module, exports) { /******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
module.exports = __WEBPACK_EXTERNAL_MODULE__0__; /******/ var getter = module && module.__esModule ?
/******/ function() { return module['default']; } :
/***/ }), /******/ function() { return module; };
/* 1 */ /******/ __webpack_require__.d(getter, { a: getter });
/***/ (function(module, __webpack_exports__, __webpack_require__) { /******/ return getter;
/******/ };
"use strict"; /******/ }();
__webpack_require__.r(__webpack_exports__); /******/
/* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); /******/ /* webpack/runtime/define property getters */
/******/ !function() {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = function(exports, definition) {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ }();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ !function() {
/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
/******/ }();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
!function() {
/* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(974);
/* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(katex__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(katex__WEBPACK_IMPORTED_MODULE_0__);
/* eslint-disable */ /* eslint-disable */
@ -160,18 +132,18 @@ __webpack_require__.r(__webpack_exports__);
// - use "" for strings that need to stay untouched // - use "" for strings that need to stay untouched
// version: "3.3.0" for MathJax and KaTeX // version: "3.3.0" for MathJax and KaTeX
// Add \ce, \pu, and \tripledash to the KaTeX macros. // Add \ce, \pu, and \tripledash to the KaTeX macros.
katex__WEBPACK_IMPORTED_MODULE_0___default.a.__defineMacro("\\ce", function (context) { katex__WEBPACK_IMPORTED_MODULE_0___default().__defineMacro("\\ce", function (context) {
return chemParse(context.consumeArgs(1)[0], "ce"); return chemParse(context.consumeArgs(1)[0], "ce");
}); });
katex__WEBPACK_IMPORTED_MODULE_0___default.a.__defineMacro("\\pu", function (context) { katex__WEBPACK_IMPORTED_MODULE_0___default().__defineMacro("\\pu", function (context) {
return chemParse(context.consumeArgs(1)[0], "pu"); return chemParse(context.consumeArgs(1)[0], "pu");
}); // Needed for \bond for the ~ forms }); // Needed for \bond for the ~ forms
// Raise by 2.56mu, not 2mu. We're raising a hyphen-minus, U+002D, not // Raise by 2.56mu, not 2mu. We're raising a hyphen-minus, U+002D, not
// a mathematical minus, U+2212. So we need that extra 0.56. // a mathematical minus, U+2212. So we need that extra 0.56.
katex__WEBPACK_IMPORTED_MODULE_0___default.a.__defineMacro("\\tripledash", "{\\vphantom{-}\\raisebox{2.56mu}{$\\mkern2mu" + "\\tiny\\text{-}\\mkern1mu\\text{-}\\mkern1mu\\text{-}\\mkern2mu$}}"); katex__WEBPACK_IMPORTED_MODULE_0___default().__defineMacro("\\tripledash", "{\\vphantom{-}\\raisebox{2.56mu}{$\\mkern2mu" + "\\tiny\\text{-}\\mkern1mu\\text{-}\\mkern1mu\\text{-}\\mkern2mu$}}");
// //
// This is the main function for handing the \ce and \pu commands. // This is the main function for handing the \ce and \pu commands.
@ -2742,9 +2714,9 @@ mhchemParser.stateMachines = {
return ret; return ret;
} }
} //#endregion }
} //#endregion
}
}; // }; //
// texify: Take MhchemParser output and convert it to TeX // texify: Take MhchemParser output and convert it to TeX
// //
@ -3235,7 +3207,9 @@ function assertNever(a) {}
function assertString(a) {} function assertString(a) {}
}();
/***/ }) __webpack_exports__ = __webpack_exports__.default;
/******/ ])["default"]; /******/ return __webpack_exports__;
/******/ })()
;
}); });

File diff suppressed because one or more lines are too long

View File

@ -2631,9 +2631,9 @@ mhchemParser.stateMachines = {
return ret; return ret;
} }
} //#endregion }
} //#endregion
}
}; // }; //
// texify: Take MhchemParser output and convert it to TeX // texify: Take MhchemParser output and convert it to TeX
// //

View File

@ -7,106 +7,78 @@
var a = typeof exports === 'object' ? factory(require("katex")) : factory(root["katex"]); var a = typeof exports === 'object' ? factory(require("katex")) : factory(root["katex"]);
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
} }
})((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__0__) { })((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__974__) {
return /******/ (function(modules) { // webpackBootstrap return /******/ (function() { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ 974:
/***/ (function(module) {
module.exports = __WEBPACK_EXTERNAL_MODULE__974__;
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache /******/ // The module cache
/******/ var installedModules = {}; /******/ var __webpack_module_cache__ = {};
/******/ /******/
/******/ // The require function /******/ // The require function
/******/ function __webpack_require__(moduleId) { /******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache /******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) { /******/ if(__webpack_module_cache__[moduleId]) {
/******/ return installedModules[moduleId].exports; /******/ return __webpack_module_cache__[moduleId].exports;
/******/ } /******/ }
/******/ // Create a new module (and put it into the cache) /******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = { /******/ var module = __webpack_module_cache__[moduleId] = {
/******/ i: moduleId, /******/ // no module.id needed
/******/ l: false, /******/ // no module.loaded needed
/******/ exports: {} /******/ exports: {}
/******/ }; /******/ };
/******/ /******/
/******/ // Execute the module function /******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/ /******/
/******/ // Return the exports of the module /******/ // Return the exports of the module
/******/ return module.exports; /******/ return module.exports;
/******/ } /******/ }
/******/ /******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 1);
/******/ })
/************************************************************************/ /************************************************************************/
/******/ ([ /******/ /* webpack/runtime/compat get default export */
/* 0 */ /******/ !function() {
/***/ (function(module, exports) { /******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
module.exports = __WEBPACK_EXTERNAL_MODULE__0__; /******/ var getter = module && module.__esModule ?
/******/ function() { return module['default']; } :
/***/ }), /******/ function() { return module; };
/* 1 */ /******/ __webpack_require__.d(getter, { a: getter });
/***/ (function(module, __webpack_exports__, __webpack_require__) { /******/ return getter;
/******/ };
"use strict"; /******/ }();
__webpack_require__.r(__webpack_exports__); /******/
/* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); /******/ /* webpack/runtime/define property getters */
/******/ !function() {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = function(exports, definition) {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ }();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ !function() {
/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
/******/ }();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
!function() {
/* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(974);
/* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(katex__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(katex__WEBPACK_IMPORTED_MODULE_0__);
/** /**
* renderA11yString returns a readable string. * renderA11yString returns a readable string.
@ -276,7 +248,8 @@ var buildString = function buildString(str, type, a11yStrings) {
if (/^\d+$/.test(ret) && a11yStrings.length > 0 && // TODO(kevinb): check that the last item in a11yStrings is a string if (/^\d+$/.test(ret) && a11yStrings.length > 0 && // TODO(kevinb): check that the last item in a11yStrings is a string
// I think we might be able to drop the nested arrays, which would make // I think we might be able to drop the nested arrays, which would make
// this easier to type - $FlowFixMe // this easier to type
// $FlowFixMe
/^\d+$/.test(a11yStrings[a11yStrings.length - 1])) { /^\d+$/.test(a11yStrings[a11yStrings.length - 1])) {
a11yStrings[a11yStrings.length - 1] += ret; a11yStrings[a11yStrings.length - 1] += ret;
} else if (ret) { } else if (ret) {
@ -429,6 +402,12 @@ var handleObject = function handleObject(tree, a11yStrings, atomType) {
break; break;
} }
case "hbox":
{
buildA11yStrings(tree.body, a11yStrings, atomType);
break;
}
case "kern": case "kern":
{ {
// No op: we don't attempt to present kerning information // No op: we don't attempt to present kerning information
@ -665,11 +644,24 @@ var handleObject = function handleObject(tree, a11yStrings, atomType) {
regionStrings.push("end strikeout"); regionStrings.push("end strikeout");
}); });
break; break;
} else if (/phase/.test(tree.label)) {
buildRegion(a11yStrings, function (regionStrings) {
regionStrings.push("start phase angle");
buildA11yStrings(tree.body, regionStrings, atomType);
regionStrings.push("end phase angle");
});
break;
} }
throw new Error("KaTeX-a11y: enclose node with " + tree.label + " not supported yet"); throw new Error("KaTeX-a11y: enclose node with " + tree.label + " not supported yet");
} }
case "vcenter":
{
buildA11yStrings(tree.body, a11yStrings, atomType);
break;
}
case "vphantom": case "vphantom":
{ {
throw new Error("KaTeX-a11y: vphantom not implemented yet"); throw new Error("KaTeX-a11y: vphantom not implemented yet");
@ -779,6 +771,16 @@ var handleObject = function handleObject(tree, a11yStrings, atomType) {
throw new Error("KaTeX-a11y: xArrow not implemented yet"); throw new Error("KaTeX-a11y: xArrow not implemented yet");
} }
case "cdlabel":
{
throw new Error("KaTeX-a11y: cdlabel not implemented yet");
}
case "cdlabelparent":
{
throw new Error("KaTeX-a11y: cdlabelparent not implemented yet");
}
case "mclass": case "mclass":
{ {
// \neq and \ne are macros so we let "htmlmathml" render the mathmal // \neq and \ne are macros so we let "htmlmathml" render the mathmal
@ -857,14 +859,16 @@ var flatten = function flatten(array) {
}; };
var renderA11yString = function renderA11yString(text, settings) { var renderA11yString = function renderA11yString(text, settings) {
var tree = katex__WEBPACK_IMPORTED_MODULE_0___default.a.__parse(text, settings); var tree = katex__WEBPACK_IMPORTED_MODULE_0___default().__parse(text, settings);
var a11yStrings = buildA11yStrings(tree, [], "normal"); var a11yStrings = buildA11yStrings(tree, [], "normal");
return flatten(a11yStrings).join(", "); return flatten(a11yStrings).join(", ");
}; };
/* harmony default export */ __webpack_exports__["default"] = (renderA11yString); /* harmony default export */ __webpack_exports__["default"] = (renderA11yString);
}();
/***/ }) __webpack_exports__ = __webpack_exports__.default;
/******/ ])["default"]; /******/ return __webpack_exports__;
/******/ })()
;
}); });

File diff suppressed because one or more lines are too long

View File

@ -15,7 +15,7 @@ import katex from '../katex.mjs';
* The commas in the string aim to increase ease of understanding * The commas in the string aim to increase ease of understanding
* when read by a screenreader. * when read by a screenreader.
*/ */
const stringMap = { var stringMap = {
"(": "left parenthesis", "(": "left parenthesis",
")": "right parenthesis", ")": "right parenthesis",
"[": "open bracket", "[": "open bracket",
@ -88,22 +88,22 @@ const stringMap = {
"\\hat": "hat", "\\hat": "hat",
"\\acute": "acute" "\\acute": "acute"
}; };
const powerMap = { var powerMap = {
"prime": "prime", "prime": "prime",
"degree": "degrees", "degree": "degrees",
"circle": "degrees", "circle": "degrees",
"2": "squared", "2": "squared",
"3": "cubed" "3": "cubed"
}; };
const openMap = { var openMap = {
"|": "open vertical bar", "|": "open vertical bar",
".": "" ".": ""
}; };
const closeMap = { var closeMap = {
"|": "close vertical bar", "|": "close vertical bar",
".": "" ".": ""
}; };
const binMap = { var binMap = {
"+": "plus", "+": "plus",
"-": "minus", "-": "minus",
"\\pm": "plus minus", "\\pm": "plus minus",
@ -115,7 +115,7 @@ const binMap = {
"\\circ": "circle", "\\circ": "circle",
"\\bullet": "bullet" "\\bullet": "bullet"
}; };
const relMap = { var relMap = {
"=": "equals", "=": "equals",
"\\approx": "approximately equals", "\\approx": "approximately equals",
"≠": "does not equal", "≠": "does not equal",
@ -131,7 +131,7 @@ const relMap = {
"\\Rightarrow": "right arrow", "\\Rightarrow": "right arrow",
":": "colon" ":": "colon"
}; };
const accentUnderMap = { var accentUnderMap = {
"\\underleftarrow": "left arrow", "\\underleftarrow": "left arrow",
"\\underrightarrow": "right arrow", "\\underrightarrow": "right arrow",
"\\underleftrightarrow": "left-right arrow", "\\underleftrightarrow": "left-right arrow",
@ -140,12 +140,12 @@ const accentUnderMap = {
"\\utilde": "tilde" "\\utilde": "tilde"
}; };
const buildString = (str, type, a11yStrings) => { var buildString = (str, type, a11yStrings) => {
if (!str) { if (!str) {
return; return;
} }
let ret; var ret;
if (type === "open") { if (type === "open") {
ret = str in openMap ? openMap[str] : stringMap[str] || str; ret = str in openMap ? openMap[str] : stringMap[str] || str;
@ -164,7 +164,8 @@ const buildString = (str, type, a11yStrings) => {
if (/^\d+$/.test(ret) && a11yStrings.length > 0 && // TODO(kevinb): check that the last item in a11yStrings is a string if (/^\d+$/.test(ret) && a11yStrings.length > 0 && // TODO(kevinb): check that the last item in a11yStrings is a string
// I think we might be able to drop the nested arrays, which would make // I think we might be able to drop the nested arrays, which would make
// this easier to type - $FlowFixMe // this easier to type
// $FlowFixMe
/^\d+$/.test(a11yStrings[a11yStrings.length - 1])) { /^\d+$/.test(a11yStrings[a11yStrings.length - 1])) {
a11yStrings[a11yStrings.length - 1] += ret; a11yStrings[a11yStrings.length - 1] += ret;
} else if (ret) { } else if (ret) {
@ -172,13 +173,13 @@ const buildString = (str, type, a11yStrings) => {
} }
}; };
const buildRegion = (a11yStrings, callback) => { var buildRegion = (a11yStrings, callback) => {
const regionStrings = []; var regionStrings = [];
a11yStrings.push(regionStrings); a11yStrings.push(regionStrings);
callback(regionStrings); callback(regionStrings);
}; };
const handleObject = (tree, a11yStrings, atomType) => { var handleObject = (tree, a11yStrings, atomType) => {
// Everything else is assumed to be an object... // Everything else is assumed to be an object...
switch (tree.type) { switch (tree.type) {
case "accent": case "accent":
@ -211,7 +212,9 @@ const handleObject = (tree, a11yStrings, atomType) => {
case "atom": case "atom":
{ {
const text = tree.text; var {
text
} = tree;
switch (tree.family) { switch (tree.family) {
case "bin": case "bin":
@ -254,7 +257,7 @@ const handleObject = (tree, a11yStrings, atomType) => {
default: default:
{ {
tree.family; tree.family;
throw new Error(`"${tree.family}" is not a valid atom type`); throw new Error("\"" + tree.family + "\" is not a valid atom type");
} }
} }
@ -263,7 +266,7 @@ const handleObject = (tree, a11yStrings, atomType) => {
case "color": case "color":
{ {
const color = tree.color.replace(/katex-/, ""); var color = tree.color.replace(/katex-/, "");
buildRegion(a11yStrings, regionStrings => { buildRegion(a11yStrings, regionStrings => {
regionStrings.push("start color " + color); regionStrings.push("start color " + color);
buildA11yStrings(tree.body, regionStrings, atomType); buildA11yStrings(tree.body, regionStrings, atomType);
@ -292,8 +295,10 @@ const handleObject = (tree, a11yStrings, atomType) => {
{ {
buildRegion(a11yStrings, regionStrings => { buildRegion(a11yStrings, regionStrings => {
// genfrac can have unbalanced delimiters // genfrac can have unbalanced delimiters
const leftDelim = tree.leftDelim, var {
rightDelim = tree.rightDelim; // NOTE: Not sure if this is a safe assumption leftDelim,
rightDelim
} = tree; // NOTE: Not sure if this is a safe assumption
// hasBarLine true -> fraction, false -> binomial // hasBarLine true -> fraction, false -> binomial
if (tree.hasBarLine) { if (tree.hasBarLine) {
@ -317,6 +322,12 @@ const handleObject = (tree, a11yStrings, atomType) => {
break; break;
} }
case "hbox":
{
buildA11yStrings(tree.body, a11yStrings, atomType);
break;
}
case "kern": case "kern":
{ {
// No op: we don't attempt to present kerning information // No op: we don't attempt to present kerning information
@ -354,8 +365,10 @@ const handleObject = (tree, a11yStrings, atomType) => {
case "op": case "op":
{ {
const body = tree.body, var {
name = tree.name; body,
name
} = tree;
if (body) { if (body) {
buildA11yStrings(body, a11yStrings, atomType); buildA11yStrings(body, a11yStrings, atomType);
@ -429,11 +442,13 @@ const handleObject = (tree, a11yStrings, atomType) => {
case "sqrt": case "sqrt":
{ {
buildRegion(a11yStrings, regionStrings => { buildRegion(a11yStrings, regionStrings => {
const body = tree.body, var {
index = tree.index; body,
index
} = tree;
if (index) { if (index) {
const indexString = flatten(buildA11yStrings(index, [], atomType)).join(","); var indexString = flatten(buildA11yStrings(index, [], atomType)).join(",");
if (indexString === "3") { if (indexString === "3") {
regionStrings.push("cube root of"); regionStrings.push("cube root of");
@ -458,10 +473,12 @@ const handleObject = (tree, a11yStrings, atomType) => {
case "supsub": case "supsub":
{ {
const base = tree.base, var {
sub = tree.sub, base,
sup = tree.sup; sub,
let isLog = false; sup
} = tree;
var isLog = false;
if (base) { if (base) {
buildA11yStrings(base, a11yStrings, atomType); buildA11yStrings(base, a11yStrings, atomType);
@ -469,17 +486,17 @@ const handleObject = (tree, a11yStrings, atomType) => {
} }
if (sub) { if (sub) {
const regionName = isLog ? "base" : "subscript"; var regionName = isLog ? "base" : "subscript";
buildRegion(a11yStrings, function (regionStrings) { buildRegion(a11yStrings, function (regionStrings) {
regionStrings.push(`start ${regionName}`); regionStrings.push("start " + regionName);
buildA11yStrings(sub, regionStrings, atomType); buildA11yStrings(sub, regionStrings, atomType);
regionStrings.push(`end ${regionName}`); regionStrings.push("end " + regionName);
}); });
} }
if (sup) { if (sup) {
buildRegion(a11yStrings, function (regionStrings) { buildRegion(a11yStrings, function (regionStrings) {
const supString = flatten(buildA11yStrings(sup, [], atomType)).join(","); var supString = flatten(buildA11yStrings(sup, [], atomType)).join(",");
if (supString in powerMap) { if (supString in powerMap) {
regionStrings.push(powerMap[supString]); regionStrings.push(powerMap[supString]);
@ -553,9 +570,22 @@ const handleObject = (tree, a11yStrings, atomType) => {
regionStrings.push("end strikeout"); regionStrings.push("end strikeout");
}); });
break; break;
} else if (/phase/.test(tree.label)) {
buildRegion(a11yStrings, function (regionStrings) {
regionStrings.push("start phase angle");
buildA11yStrings(tree.body, regionStrings, atomType);
regionStrings.push("end phase angle");
});
break;
} }
throw new Error(`KaTeX-a11y: enclose node with ${tree.label} not supported yet`); throw new Error("KaTeX-a11y: enclose node with " + tree.label + " not supported yet");
}
case "vcenter":
{
buildA11yStrings(tree.body, a11yStrings, atomType);
break;
} }
case "vphantom": case "vphantom":
@ -603,9 +633,9 @@ const handleObject = (tree, a11yStrings, atomType) => {
case "verb": case "verb":
{ {
buildString(`start verbatim`, "normal", a11yStrings); buildString("start verbatim", "normal", a11yStrings);
buildString(tree.body, "normal", a11yStrings); buildString(tree.body, "normal", a11yStrings);
buildString(`end verbatim`, "normal", a11yStrings); buildString("end verbatim", "normal", a11yStrings);
break; break;
} }
@ -616,9 +646,9 @@ const handleObject = (tree, a11yStrings, atomType) => {
case "horizBrace": case "horizBrace":
{ {
buildString(`start ${tree.label.slice(1)}`, "normal", a11yStrings); buildString("start " + tree.label.slice(1), "normal", a11yStrings);
buildA11yStrings(tree.base, a11yStrings, atomType); buildA11yStrings(tree.base, a11yStrings, atomType);
buildString(`end ${tree.label.slice(1)}`, "normal", a11yStrings); buildString("end " + tree.label.slice(1), "normal", a11yStrings);
break; break;
} }
@ -667,13 +697,24 @@ const handleObject = (tree, a11yStrings, atomType) => {
throw new Error("KaTeX-a11y: xArrow not implemented yet"); throw new Error("KaTeX-a11y: xArrow not implemented yet");
} }
case "cdlabel":
{
throw new Error("KaTeX-a11y: cdlabel not implemented yet");
}
case "cdlabelparent":
{
throw new Error("KaTeX-a11y: cdlabelparent not implemented yet");
}
case "mclass": case "mclass":
{ {
// \neq and \ne are macros so we let "htmlmathml" render the mathmal // \neq and \ne are macros so we let "htmlmathml" render the mathmal
// side of things and extract the text from that. // side of things and extract the text from that.
const atomType = tree.mclass.slice(1); // $FlowFixMe: drop the leading "m" from the values in mclass var _atomType = tree.mclass.slice(1); // $FlowFixMe: drop the leading "m" from the values in mclass
buildA11yStrings(tree.body, a11yStrings, atomType);
buildA11yStrings(tree.body, a11yStrings, _atomType);
break; break;
} }
@ -715,13 +756,13 @@ const handleObject = (tree, a11yStrings, atomType) => {
} }
}; };
const buildA11yStrings = function buildA11yStrings(tree, a11yStrings, atomType) { var buildA11yStrings = function buildA11yStrings(tree, a11yStrings, atomType) {
if (a11yStrings === void 0) { if (a11yStrings === void 0) {
a11yStrings = []; a11yStrings = [];
} }
if (tree instanceof Array) { if (tree instanceof Array) {
for (let i = 0; i < tree.length; i++) { for (var i = 0; i < tree.length; i++) {
buildA11yStrings(tree[i], a11yStrings, atomType); buildA11yStrings(tree[i], a11yStrings, atomType);
} }
} else { } else {
@ -731,8 +772,8 @@ const buildA11yStrings = function buildA11yStrings(tree, a11yStrings, atomType)
return a11yStrings; return a11yStrings;
}; };
const flatten = function flatten(array) { var flatten = function flatten(array) {
let result = []; var result = [];
array.forEach(function (item) { array.forEach(function (item) {
if (item instanceof Array) { if (item instanceof Array) {
result = result.concat(flatten(item)); result = result.concat(flatten(item));
@ -743,10 +784,10 @@ const flatten = function flatten(array) {
return result; return result;
}; };
const renderA11yString = function renderA11yString(text, settings) { var renderA11yString = function renderA11yString(text, settings) {
const tree = katex.__parse(text, settings); var tree = katex.__parse(text, settings);
const a11yStrings = buildA11yStrings(tree, [], "normal"); var a11yStrings = buildA11yStrings(tree, [], "normal");
return flatten(a11yStrings).join(", "); return flatten(a11yStrings).join(", ");
}; };

View File

@ -130,9 +130,11 @@
-ms-high-contrast-adjust: none !important; -ms-high-contrast-adjust: none !important;
} }
.katex .katex-version::after { .katex .katex-version::after {
content: "0.12.0"; content: "0.13.0";
} }
.katex .katex-mathml { .katex .katex-mathml {
/* Accessibility hack to only show to screen readers
Found at: http://a11yproject.com/posts/how-to-hide-content/ */
position: absolute; position: absolute;
clip: rect(1px, 1px, 1px, 1px); clip: rect(1px, 1px, 1px, 1px);
padding: 0; padding: 0;
@ -151,6 +153,8 @@
position: relative; position: relative;
display: inline-block; display: inline-block;
white-space: nowrap; white-space: nowrap;
width: -webkit-min-content;
width: -moz-min-content;
width: min-content; width: min-content;
} }
.katex .strut { .katex .strut {
@ -266,16 +270,12 @@
min-width: 2px; min-width: 2px;
} }
.katex .vbox { .katex .vbox {
display: -ms-inline-flexbox;
display: inline-flex; display: inline-flex;
-ms-flex-direction: column;
flex-direction: column; flex-direction: column;
align-items: baseline; align-items: baseline;
} }
.katex .hbox { .katex .hbox {
display: -ms-inline-flexbox;
display: inline-flex; display: inline-flex;
-ms-flex-direction: row;
flex-direction: row; flex-direction: row;
width: 100%; width: 100%;
} }
@ -352,6 +352,8 @@
border-bottom-style: dashed; border-bottom-style: dashed;
} }
.katex .sqrt > .root { .katex .sqrt > .root {
/* These values are taken from the definition of `\r@@t`,
`\mkern 5mu` and `\mkern -10mu`. */
margin-left: 0.27777778em; margin-left: 0.27777778em;
margin-right: -0.55555556em; margin-right: -0.55555556em;
} }
@ -982,6 +984,9 @@
.katex .x-arrow-pad { .katex .x-arrow-pad {
padding: 0 0.5em; padding: 0 0.5em;
} }
.katex .cd-arrow-pad {
padding: 0 0.55556em 0 0.27778em;
}
.katex .x-arrow, .katex .x-arrow,
.katex .mover, .katex .mover,
.katex .munder { .katex .munder {
@ -1006,6 +1011,42 @@
border-bottom-style: solid; border-bottom-style: solid;
border-bottom-width: 0.08em; border-bottom-width: 0.08em;
} }
.katex .angl {
box-sizing: border-content;
border-top: 0.049em solid;
border-right: 0.049em solid;
margin-right: 0.03889em;
}
.katex .anglpad {
padding: 0 0.03889em 0 0.03889em;
}
.katex .eqn-num::before {
counter-increment: katexEqnNo;
content: "(" counter(katexEqnNo) ")";
}
.katex .mml-eqn-num::before {
counter-increment: mmlEqnNo;
content: "(" counter(mmlEqnNo) ")";
}
.katex .mtr-glue {
width: 50%;
}
.katex .cd-vert-arrow {
display: inline-block;
position: relative;
}
.katex .cd-label-left {
display: inline-block;
position: absolute;
right: calc(50% + 0.3em);
text-align: left;
}
.katex .cd-label-right {
display: inline-block;
position: absolute;
left: calc(50% + 0.3em);
text-align: right;
}
.katex-display { .katex-display {
display: block; display: block;
margin: 1em 0; margin: 1em 0;
@ -1032,4 +1073,7 @@
text-align: left; text-align: left;
padding-left: 2em; padding-left: 2em;
} }
body {
counter-reset: katexEqnNo mmlEqnNo;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff