支持数学公式和docs页面修改

支持数学公式和docs页面修改
This commit is contained in:
2021-05-13 00:16:22 +08:00
parent afd35da17f
commit 64582c4a57
4 changed files with 116 additions and 14 deletions
@@ -1,4 +1,4 @@
# 队列\_剑指Offer59题\_队列的最大值问题 # 队列的最大值问题
## 题目描述如下: ## 题目描述如下:
+97 -11
View File
@@ -6,30 +6,116 @@ sidebar_position: 1
欢迎来到这里 **Docusaurus in less than 1 minutes**. 欢迎来到这里 **Docusaurus in less than 1 minutes**.
## Getting Started ## 现在开始
Get started by **creating a new site**. Get started by **creating a new site**.
Or **try Docusaurus immediately** with **[new.docusaurus.io](https://new.docusaurus.io)**. Or **try Docusaurus immediately** with **[new.docusaurus.io](https://new.docusaurus.io)**.
## Generate a new site ## 代码块
Generate a new Docusaurus site using the **classic template**:
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
<Tabs
defaultValue="js"
values={[
{ label: 'JavaScript', value: 'js', },
{ label: 'Python', value: 'py', },
{ label: 'Java', value: 'java', },
]
}>
<TabItem value="js">
```js
function helloWorld() {
console.log('Hello, world!');
}
```
</TabItem>
<TabItem value="py">
```py
def hello_world():
print 'Hello, world!'
```
</TabItem>
<TabItem value="java">
```java
class HelloWorld {
public static void main(String args[]) {
System.out.println("Hello, World");
}
}
```
</TabItem>
</Tabs>
以上是一些语言的‘Hello World
JS**:
```jsx title="/src/components/HelloCodeTitle.js"
function HelloCodeTitle(props) {
return <h1>Hello, {props.name}</h1>;
}
```
shell**:
```shell ```shell
npx @docusaurus/init@latest init my-website classic npx @docusaurus/init@latest init my-website classic
``` ```
## Start your site ## 开启Code-Docs服务
Run the development server: Run the development server:
```shell
cd my-website
npx docusaurus start
```
Your site starts at `http://localhost:3000`. Your site starts at `http://localhost:3000`.
Open `docs/getting-started.md` and edit some lines: the site **reloads automatically** and display your changes.
## 行公式 TeX(KaTeX)
公式:
https://github.com/remarkjs/remark-math .
语法:
https://katex.org/ .
**Fundamental Theorem of Calculus**
Let $f:[a,b] \to \R$ be Riemann integrable. Let $F:[a,b]\to\R$ be $F(x)=
\int_{a}^{x}f(t)dt$.
Then $$F$$ is continuous, and at all $x$ such that $f$ is continuous at $x$,
$F$ is differentiable at $x$ with $F'(x)=f(x)$.
### 科学公式 TeX(KaTeX)
$$E=mc^2$$
行内的公式$$E=mc^2$$行内的公式,行内的$$E=mc^2$$公式。
$$\(\sqrt{3x-1}+(1+x)^2\)$$
$$\sin(\alpha)^{\theta}=\sum_{i=0}^{n}(x^i + \cos(f))$$
Text
$$
\int_0^\infty f(x)dx
$$
More Text
MEISHI
+14
View File
@@ -1,4 +1,7 @@
/** @type {import('@docusaurus/types').DocusaurusConfig} */ /** @type {import('@docusaurus/types').DocusaurusConfig} */
const math = require('remark-math');
const katex = require('rehype-katex');
module.exports = { module.exports = {
title: 'CodeDocs 编程文档', title: 'CodeDocs 编程文档',
tagline: 'CodeDocs 编程文档 -- 这里是一些技术人的编程文档', tagline: 'CodeDocs 编程文档 -- 这里是一些技术人的编程文档',
@@ -109,6 +112,15 @@ module.exports = {
copyright: `Copyright © ${new Date().getFullYear()} Code Docs, Inc. 一些技术人的编程文档网站.`, copyright: `Copyright © ${new Date().getFullYear()} Code Docs, Inc. 一些技术人的编程文档网站.`,
}, },
}, },
stylesheets: [
{
href: 'https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.css',
type: 'text/css',
integrity:
'sha384-AfEj0r4/OFrOo5t7NnNe46zW/tFgW6x/bCJG8FqQCEo3+Aro6EYUG4+cU+KJWu/X',
crossorigin: 'anonymous',
},
],
presets: [ presets: [
[ [
'@docusaurus/preset-classic', '@docusaurus/preset-classic',
@@ -116,6 +128,8 @@ module.exports = {
docs: { docs: {
sidebarPath: require.resolve('./sidebars.js'), sidebarPath: require.resolve('./sidebars.js'),
// Please change this to your repo. // Please change this to your repo.
remarkPlugins: [math],
rehypePlugins: [katex],
editUrl: editUrl:
'https://github.com/facebook/docusaurus/edit/master/website/', 'https://github.com/facebook/docusaurus/edit/master/website/',
}, },
+3 -1
View File
@@ -19,7 +19,9 @@
"@mdx-js/react": "^1.6.21", "@mdx-js/react": "^1.6.21",
"clsx": "^1.1.1", "clsx": "^1.1.1",
"react": "^17.0.1", "react": "^17.0.1",
"react-dom": "^17.0.1" "react-dom": "^17.0.1",
"rehype-katex": "^4.0.0",
"remark-math": "^3.0.1"
}, },
"browserslist": { "browserslist": {
"production": [ "production": [