Skip to content

Commit cf08a89

Browse files
committed
init framework
1 parent 3942917 commit cf08a89

File tree

12 files changed

+2845
-0
lines changed

12 files changed

+2845
-0
lines changed

.gitignore

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
.pnpm-debug.log*
9+
10+
# Diagnostic reports (https://nodejs.org/api/report.html)
11+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
12+
13+
# Runtime data
14+
pids
15+
*.pid
16+
*.seed
17+
*.pid.lock
18+
19+
# Directory for instrumented libs generated by jscoverage/JSCover
20+
lib-cov
21+
22+
# Coverage directory used by tools like istanbul
23+
coverage
24+
*.lcov
25+
26+
# nyc test coverage
27+
.nyc_output
28+
29+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
30+
.grunt
31+
32+
# Bower dependency directory (https://bower.io/)
33+
bower_components
34+
35+
# node-waf configuration
36+
.lock-wscript
37+
38+
# Compiled binary addons (https://nodejs.org/api/addons.html)
39+
build/Release
40+
41+
# Dependency directories
42+
node_modules/
43+
jspm_packages/
44+
45+
# Snowpack dependency directory (https://snowpack.dev/)
46+
web_modules/
47+
48+
# TypeScript cache
49+
*.tsbuildinfo
50+
51+
# Optional npm cache directory
52+
.npm
53+
54+
# Optional eslint cache
55+
.eslintcache
56+
57+
# Optional stylelint cache
58+
.stylelintcache
59+
60+
# Microbundle cache
61+
.rpt2_cache/
62+
.rts2_cache_cjs/
63+
.rts2_cache_es/
64+
.rts2_cache_umd/
65+
66+
# Optional REPL history
67+
.node_repl_history
68+
69+
# Output of 'npm pack'
70+
*.tgz
71+
72+
# Yarn Integrity file
73+
.yarn-integrity
74+
75+
# dotenv environment variable files
76+
.env
77+
.env.development.local
78+
.env.test.local
79+
.env.production.local
80+
.env.local
81+
82+
# parcel-bundler cache (https://parceljs.org/)
83+
.cache
84+
.parcel-cache
85+
86+
# Next.js build output
87+
.next
88+
out
89+
90+
# Nuxt.js build / generate output
91+
.nuxt
92+
dist
93+
94+
# Gatsby files
95+
.cache/
96+
# Comment in the public line in if your project uses Gatsby and not Next.js
97+
# https://nextjs.org/blog/next-9-1#public-directory-support
98+
# public
99+
100+
# vuepress build output
101+
.vuepress/dist
102+
103+
# vuepress v2.x temp and cache directory
104+
.temp
105+
.cache
106+
107+
# Docusaurus cache and generated files
108+
.docusaurus
109+
110+
# Serverless directories
111+
.serverless/
112+
113+
# FuseBox cache
114+
.fusebox/
115+
116+
# DynamoDB Local files
117+
.dynamodb/
118+
119+
# TernJS port file
120+
.tern-port
121+
122+
# Stores VSCode versions used for testing VSCode extensions
123+
.vscode-test
124+
125+
# yarn v2
126+
.yarn/cache
127+
.yarn/unplugged
128+
.yarn/build-state.yml
129+
.yarn/install-state.gz
130+
.pnp.*

next.config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// next.config.js
2+
const withNextra = require('nextra')({
3+
theme: 'nextra-theme-docs',
4+
themeConfig: './theme.config.js',
5+
// optional: add `unstable_staticImage: true` to enable Nextra's auto image import
6+
})
7+
module.exports = withNextra()

package.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"dependencies": {
3+
"better-react-mathjax": "^2.0.0",
4+
"next": "^12.1.5",
5+
"nextra": "^1.1.0",
6+
"nextra-theme-docs": "^1.2.6",
7+
"react": "^18.0.0",
8+
"react-dom": "^18.0.0"
9+
}
10+
}

pages/Hedgehog-Script/Hello-World.mdx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import Bleed from 'nextra-theme-docs/bleed'
2+
import Callout from 'nextra-theme-docs/callout'
3+
import { MathJax, MathJaxContext } from 'better-react-mathjax'
4+
5+
Use  `print()` function to print `"hello world"` string in Hedgehog Lab:
6+
7+
<Bleed full>
8+
<iframe
9+
src="https://hhlab.dev/?code=%2F%2Fauthor%20Jason%20Reynolds%0A%2F*simple%20js%20wrapper%20for%20QR%20function%2F%0A%2Ffunction%20that%20takes%20in%20a%20raw%20or%20object%20matrix%2C%20decomposes%20it%20using%20QR%20method%2C%20and%20return%20the%20Q%20and%20R%20as%20objects*%2F%0Afunction%20QR(inputMatrix)%7B%0A%20%20%20%20%2F%2Fin%20the%20case%20of%20the%20instance%20being%20a%20Mat%20object%20rather%20than%20a%20raw%20array%0A%20%20%20%20if%20(inputMatrix%20instanceof%20Mat)%7B%0A%20%20%20%20%20%20%20%20%2F%2Fassign%20a%20variable%20to%20be%20the%20matrix%20(MAT)%20raw%20form%0A%20%20%20%20%20%20%20%20let%20raw2DArray%20%3D%20inputMatrix.val%3B%0A%20%20%20%20%20%20%20%20%2F%2Foutput%20result%20from%20mathjavascript%20as%202%20objects%3A%20Q%20and%20R%0A%20%20%20%20%20%20%20%20let%20result%20%3D%20mathjs.qr(raw2DArray)%3B%0A%20%20%20%20%20%20%20%20return%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Q%3A%20mat(result.Q)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20R%3A%20mat(result.R)%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%20%20%20%20%2F%2Fin%20the%20other%20case%2C%20that%20it's%20a%20raw%20array%0A%20%20%20%20let%20result%20%3D%20mathjs.qr(inputMatrix)%3B%0A%20%20%20%20return%20%7B%0A%20%20%20%20%20%20%20%20Q%3A%20mat(result.Q)%2C%0A%20%20%20%20%20%20%20%20R%3A%20mat(result.R)%0A%20%20%20%20%7D%0A%7D%20&auto_run=true"
10+
width="100%"
11+
height="500px"
12+
title="SWR-States"
13+
></iframe>
14+
</Bleed>

pages/Hedgehog-Script/meta.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"Hello-World": "Hello World"
3+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# About Hedgehog Book
2+
3+
This is an interactive math-algorithm-code book powered by Hedgehog Lab ([https://github.com/Hedgehog-Computing/hedgehog-lab](https://github.com/Hedgehog-Computing/hedgehog-lab)).
4+
5+
All the codes provided in this book are **Hedgehog Script**. Every snippet can be compiled and executed totally inside your browser, and can be executed in Hedgehog Lab ([https://hedgehog-lab.github.io](https://hedgehog-lab.github.io)).
6+
7+
Read this book at [https://hedgehog-book.github.io/](https://hedgehog-book.github.io/).
8+
9+
## Author
10+
11+
Xinran Wang, founder of [Hedgehog Computing](https://github.com/Hedgehog-Computing) ([https://linktr.ee/lidang](https://linktr.ee/lidang)).
12+
13+
## Cite Hedgehog Book
14+
15+
If you use Hedgehog Book in your research or study, please use the following BibTeX entry
16+
17+
```
18+
@misc{HedgehogBook2022,
19+
author = {Xinran Wang},
20+
title = {Hedgehog Book},
21+
howpublished = {\url{https://hedgehog-book.github.io/}},
22+
year = {2021}
23+
}
24+
```
25+
26+
## Contribute to this book
27+
28+
This book is written in Markdown, built with GitBook and served with Github Pages.
29+
30+
Install GitBook via NPM:
31+
32+
```
33+
$ npm install gitbook-cli -g
34+
```
35+
36+
Install all plugins for this book:
37+
38+
```
39+
$ gitbook install
40+
```
41+
42+
Launch GitBook development server:
43+
44+
```
45+
$ gitbook serve
46+
```
47+
48+
Build a release version of Hedgehog Book at "_book" folder:
49+
50+
```
51+
$ gitbook build
52+
```
53+
54+
For more details, please check [Contribute to this book](contribute.md) chapter for more details.

pages/Introduction/meta.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"About-this-Book" : "About this Book"
3+
}

pages/_app.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import 'nextra-theme-docs/style.css'
2+
export default function Nextra({ Component, pageProps }) {
3+
return <Component {...pageProps} />
4+
}

pages/index.mdx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
import Bleed from 'nextra-theme-docs/bleed'
3+
import Callout from 'nextra-theme-docs/callout'
4+
import { MathJax, MathJaxContext } from 'better-react-mathjax'
5+
6+
7+
8+
<MathJaxContext>
9+
Basic MathJax example with Latex
10+
<MathJax>{"\\(\\frac{10}{4x} \\approx 2^{12}\\)"}</MathJax>
11+
</MathJaxContext>
12+
13+
hello world!
14+
15+
<Callout>
16+
Give [**Nextra**](https://github.com/shuding/nextra) a star!
17+
</Callout>
18+
19+
<Bleed>Hey, I can use **Markdown** syntax here.</Bleed>
20+
<Bleed full>
21+
![Landscape](https://source.unsplash.com/eaxwP9J_V6s/1600x398)
22+
</Bleed>
23+
<Bleed full>
24+
<iframe
25+
src="https://hhlab.dev/?code=%2F%2Fauthor%20Jason%20Reynolds%0A%2F*simple%20js%20wrapper%20for%20QR%20function%2F%0A%2Ffunction%20that%20takes%20in%20a%20raw%20or%20object%20matrix%2C%20decomposes%20it%20using%20QR%20method%2C%20and%20return%20the%20Q%20and%20R%20as%20objects*%2F%0Afunction%20QR(inputMatrix)%7B%0A%20%20%20%20%2F%2Fin%20the%20case%20of%20the%20instance%20being%20a%20Mat%20object%20rather%20than%20a%20raw%20array%0A%20%20%20%20if%20(inputMatrix%20instanceof%20Mat)%7B%0A%20%20%20%20%20%20%20%20%2F%2Fassign%20a%20variable%20to%20be%20the%20matrix%20(MAT)%20raw%20form%0A%20%20%20%20%20%20%20%20let%20raw2DArray%20%3D%20inputMatrix.val%3B%0A%20%20%20%20%20%20%20%20%2F%2Foutput%20result%20from%20mathjavascript%20as%202%20objects%3A%20Q%20and%20R%0A%20%20%20%20%20%20%20%20let%20result%20%3D%20mathjs.qr(raw2DArray)%3B%0A%20%20%20%20%20%20%20%20return%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Q%3A%20mat(result.Q)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20R%3A%20mat(result.R)%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%20%20%20%20%2F%2Fin%20the%20other%20case%2C%20that%20it's%20a%20raw%20array%0A%20%20%20%20let%20result%20%3D%20mathjs.qr(inputMatrix)%3B%0A%20%20%20%20return%20%7B%0A%20%20%20%20%20%20%20%20Q%3A%20mat(result.Q)%2C%0A%20%20%20%20%20%20%20%20R%3A%20mat(result.R)%0A%20%20%20%20%7D%0A%7D%20&auto_run=true"
26+
width="100%"
27+
height="500px"
28+
title="SWR-States"
29+
></iframe>
30+
</Bleed>

pages/meta.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"Introduction": "Introduction",
3+
"Hedgehog-Script": "Hedgehog Script"
4+
}

theme.config.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// theme.config.js
2+
export default {
3+
projectLink: 'https://github.com/shuding/nextra', // GitHub link in the navbar
4+
docsRepositoryBase: 'https://github.com/shuding/nextra/blob/master', // base URL for the docs repository
5+
titleSuffix: ' – Nextra',
6+
nextLinks: true,
7+
prevLinks: true,
8+
search: true,
9+
customSearch: null, // customizable, you can use algolia for example
10+
darkMode: true,
11+
footer: true,
12+
footerText: `MIT ${new Date().getFullYear()} © Shu Ding.`,
13+
footerEditLink: `Edit this page on GitHub`,
14+
logo: (
15+
<>
16+
<svg>...</svg>
17+
<span>Next.js Static Site Generator</span>
18+
</>
19+
),
20+
head: (
21+
<>
22+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
23+
<meta name="description" content="Nextra: the next docs builder" />
24+
<meta name="og:title" content="Nextra: the next docs builder" />
25+
</>
26+
),
27+
}

0 commit comments

Comments
 (0)