Skip to content

Commit 4147d89

Browse files
authored
Merge pull request #138 from jorenham/katex
2 parents af10e69 + dc7f0e1 commit 4147d89

File tree

5 files changed

+239
-148
lines changed

5 files changed

+239
-148
lines changed

.dprint.jsonc

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,26 @@
1313
"markdown": {
1414
"emphasisKind": "asterisks",
1515
},
16+
"markup": {
17+
"printWidth": 100,
18+
"preferAttrsSingleLine": false,
19+
},
1620
"yaml": {
1721
"formatComments": true,
1822
"braceSpacing": false,
1923
},
24+
"typescript": {
25+
"semiColons": "asi",
26+
"quoteProps": "consistent",
27+
"spaceSurroundingProperties": false,
28+
"preferSingleLine": true,
29+
},
2030
"plugins": [
31+
"https://plugins.dprint.dev/g-plane/markup_fmt-v0.24.0.wasm",
2132
"https://plugins.dprint.dev/g-plane/pretty_yaml-v0.5.1.wasm",
22-
"https://plugins.dprint.dev/json-0.20.0.wasm",
23-
"https://plugins.dprint.dev/markdown-0.19.0.wasm",
33+
"https://plugins.dprint.dev/json-0.21.0.wasm",
34+
"https://plugins.dprint.dev/markdown-0.20.0.wasm",
2435
"https://plugins.dprint.dev/toml-0.7.0.wasm",
36+
"https://plugins.dprint.dev/typescript-0.95.12.wasm",
2537
],
2638
}

Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,17 @@ version = "0.3.3+0.1.3"
44
authors = ["Joren Hammudoglu <[email protected]>"]
55
categories = ["api-bindings", "mathematics", "science"]
66
edition = "2024"
7-
include = ["*.rs", "xsf/include"]
7+
include = ["*.rs", "xsf/include", "katex.html"]
88
keywords = ["ffi", "bindings", "math", "xsf", "scipy"]
99
license = "BSD-3-Clause"
1010
readme = "README.md"
1111
repository = "https://github.com/jorenham/xsf-rust"
1212
rust-version = "1.85.1"
1313
description = "Bindings for SciPy special functions"
1414

15+
[package.metadata.docs.rs]
16+
rustdoc-args = ["--html-in-header", "katex.html"]
17+
1518
[dependencies]
1619
num-complex = "0.4.6"
1720
num-traits = "0.2.19"

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
doc:
2+
RUSTDOCFLAGS="--html-in-header katex.html" cargo +nightly doc --all-features --no-deps

katex.html

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<link
2+
rel="stylesheet"
3+
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css"
4+
integrity="sha384-WcoG4HRXMzYzfCgiyfrySxx90XSl2rxY5mnVY5TwtWE6KLrArNKn0T/mOgNL0Mmi"
5+
crossorigin="anonymous"
6+
>
7+
<script
8+
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js"
9+
integrity="sha384-J+9dG2KMoiR9hqcFao0IBLwxt6zpcyN68IgwzsCSkbreXUjmNVRhPFTssqdSGjwQ"
10+
crossorigin="anonymous"
11+
>
12+
</script>
13+
<script
14+
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js"
15+
integrity="sha384-hCXGrW6PitJEwbkoStFjeJxv+fSOOQKOPbJxSfM6G5sWZjAyWhXiTIIAmQqnlLlh"
16+
crossorigin="anonymous"
17+
>
18+
</script>
19+
<script
20+
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/copy-tex.min.js"
21+
integrity="sha384-HORx6nWi8j5/mYA+y57/9/CZc5z8HnEw4WUZWy5yOn9ToKBv1l58vJaufFAn9Zzi"
22+
crossorigin="anonymous"
23+
>
24+
</script>
25+
26+
<script>
27+
document.addEventListener("DOMContentLoaded", () => {
28+
renderMathInElement(document.body, {
29+
strict: "error",
30+
throwOnError: true,
31+
trust: true,
32+
delimiters: [{left: "$$", right: "$$", display: true}, {left: "$", right: "$", display: false}],
33+
macros: {
34+
// Beta function
35+
"\\B": "\\mathop{\\Beta}",
36+
37+
// error function
38+
"\\erf": "\\mathop{\\mathrm{erf}}",
39+
"\\erfc": "\\mathop{\\mathrm{erfc}}",
40+
"\\erfi": "\\mathop{\\mathrm{erfi}}",
41+
42+
// sign function
43+
"\\sgn": "\\mathop{\\mathrm{sgn}}",
44+
45+
// kelvin functions
46+
"\\ber": "\\mathop{\\mathrm{ber}}",
47+
"\\berp": "\\mathop{\\mathrm{ber}'}",
48+
"\\bei": "\\mathop{\\mathrm{bei}}",
49+
"\\beip": "\\mathop{\\mathrm{bei}'}",
50+
"\\ker": "\\mathop{\\mathrm{ker}}",
51+
"\\kerp": "\\mathop{\\mathrm{ker}'}",
52+
"\\kei": "\\mathop{\\mathrm{kei}}",
53+
"\\keip": "\\mathop{\\mathrm{kei}'}",
54+
55+
// sine and cosine integrals
56+
"\\Si": "\\mathop{\\mathrm{Si}}",
57+
"\\Ci": "\\mathop{\\mathrm{Ci}}",
58+
"\\Shi": "\\mathop{\\mathrm{Shi}}",
59+
"\\Chi": "\\mathop{\\mathrm{Chi}}",
60+
61+
// falling and rising factorials
62+
"\\fpow": "#1^{\\overline{#2}}",
63+
"\\rpow": "#1^{\\underline{#2}}",
64+
65+
// some missing "physics" tex package commands
66+
"\\dd": "\\,\\mathrm{d}{#1}",
67+
},
68+
})
69+
})
70+
</script>
71+
72+
<style>
73+
.docblock > p { overflow-y: hidden }
74+
</style>

0 commit comments

Comments
 (0)