Improve supported functions documentation 2 (#1576)

* Move remarkable plugins to website/lib

* Bypass escaped delimiter

* Add redirect page

* Include stylesheet in the documentation for versioning
This commit is contained in:
ylemkimon
2018-08-09 21:54:58 +09:00
committed by GitHub
parent 8fb92f6866
commit eab8f24333
6 changed files with 28 additions and 6 deletions

View File

@@ -2,7 +2,7 @@
id: support_table
title: Support Table
---
<!-- {@stylesheet: static/katex.min.css} -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.10.0-beta/dist/katex.min.css" integrity="sha384-9tPv11A+glH/on/wEu99NVwDPwkMQESOocs/ZGXPoIiLE8MU/qkqUcZ3zzL+6DuH" crossorigin="anonymous">
<style>
table tr,
table td {

View File

@@ -2,6 +2,7 @@
id: supported
title: Supported Functions
---
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.10.0-beta/dist/katex.min.css" integrity="sha384-9tPv11A+glH/on/wEu99NVwDPwkMQESOocs/ZGXPoIiLE8MU/qkqUcZ3zzL+6DuH" crossorigin="anonymous">
<style>
table tr,
table td {
@@ -531,7 +532,7 @@ One can stack font family, font weight, and font shape by using the `\textXX` v
|$`$ <code>`</code>|$\triangledown$ `\triangledown` |$\sphericalangle$ `\sphericalangle`
|$\text{\textquoteleft}$ `\text{\textquoteleft}` |$\triangleleft$ `\triangleleft` |$\top$ `\top`
|$\lq$ `\lq` |$\triangleright$ `\triangleright`|$\bot$ `\bot`
|$\text{\textquoteright}$ `\text{\textquoteright}`|$\bigtriangledown$ `\bigtriangledown` |$\text{\textdollar}$ `\$`
|$\text{\textquoteright}$ `\text{\textquoteright}`|$\bigtriangledown$ `\bigtriangledown` |$\$$ `\$`
|$\rq$ `\rq` |$\bigtriangleup$ `\bigtriangleup`|$\text{\textdollar}$ `\text{\textdollar}`
|$\text{\textquotedblleft}$ `\text{\textquotedblleft}` |$\blacktriangle$ `\blacktriangle`|$\pounds$ `\pounds`
|$"$ `"`|$\blacktriangledown$ `\blacktriangledown` |$\text{\textsterling}$ `\text{\textsterling}`

View File

@@ -26,7 +26,7 @@ SOFTWARE.
* sequences into math HTML using the KaTeX package.
*/
module.exports = function(md, options) {
const katex = require("../");
const katex = require("../../");
function renderKatex(source, displayMode) {
return katex.renderToString(source, {displayMode, throwOnError: false});
@@ -130,11 +130,13 @@ module.exports = function(md, options) {
*/
function parseInlineKatex(state, silent) {
const dollar = 0x24;
const backslash = 0x5c;
let pos = state.pos;
const start = pos;
const max = state.posMax;
let matchStart;
let matchEnd ;
let matchEnd;
let esc;
if (state.src.charCodeAt(pos) !== dollar) { return false; }
++pos;
@@ -151,6 +153,13 @@ module.exports = function(md, options) {
while ((matchStart = state.src.indexOf('$', matchEnd)) !== -1) {
matchEnd = matchStart + 1;
// bypass escaped delimiters
esc = matchStart - 1;
while (state.src.charCodeAt(esc) === backslash) {
--esc;
}
if ((matchStart - esc) % 2 === 0) { continue; }
while (matchEnd < max && state.src.charCodeAt(matchEnd) === dollar) {
++matchEnd;
}

View File

@@ -65,13 +65,15 @@ const siteConfig = {
theme: 'default',
},
markdownPlugins: [require('./remarkableKatex'), require('./empty_thead')],
markdownPlugins: [
require('./lib/remarkableKatex'),
require('./lib/empty_thead'),
],
scripts: [
'https://buttons.github.io/buttons.js',
baseUrl + 'js/scrollspy.js',
],
stylesheets: ['https://cdn.jsdelivr.net/npm/katex@0.10.0-beta/dist/katex.min.css'],
separateCss: ['static/static', 'static\\static'],

View File

@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Function Support in KaTeX</title>
<meta http-equiv="refresh" content="0;URL='./docs/supported.html'" />
</head>
<body>
<p>This page has moved to the <a href="./docs/supported.html">documentation</a>.</p>
</body>
</html>