Skip to content

Commit

Permalink
update README and install prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
MR-Addict committed May 11, 2023
1 parent 84fc552 commit c955c9a
Show file tree
Hide file tree
Showing 10 changed files with 248 additions and 164 deletions.
13 changes: 13 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/.git
/node_modules
/build
/public
/package
/.env.*
/.vercel
/.docusaurus

# Ignore files for PNPM, NPM and YARN
/pnpm-lock.yaml
/package-lock.json
/yarn.lock
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"useTabs": false,
"singleQuote": false,
"trailingComma": "none",
"printWidth": 120,
"pluginSearchDirs": ["."]
}
48 changes: 46 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,49 @@
# 技术部文档 [![pages](https://github.com/NJTUSTAS/njtustas.github.io/actions/workflows/pages.yml/badge.svg)](https://github.com/NJTUSTAS/njtustas.github.io/actions/workflows/pages.yml)
# 技术部文档 ![pages](https://github.com/NJTUSTAS/njtustas.github.io/actions/workflows/pages.yml/badge.svg)

可用链接:
## 1. 项目开发

开发项目:

```
npm start
```

启动后会自动跳转至[http://localhost:3000](http://localhost:3000)

## 2. 注意事项

### 2.1 前提和基础

首先你需要有使用 Git、Github 的经验,会写 Markdown。

另外,本项目使用的文档框架是[Docusaurus](https://docusaurus.io/),也是由 Facebook 领导开发的一个开源项目,底层使用的是 React 和 Webpack,开发前建议先阅读一下相关文档。如果你要开发独立的页面,需要了解 React 和 Typescript;如果只是写文档和文章,只需要知道这个框架的结构,会写 Markdown 就可以了。

### 2.2 Mardkown 规范

**安装插件**

写 Markdown 文档或者文章的时候,建议安装这两个插件以保证格式的统一性:

![markdown-plugin](./images/markdown-plugin.png)

**内容规范**

书写的内容请保证条理性和严谨性,书写的规范请参考已有的文章。

**压缩图片**

在 Markdown 中使用的图片最好先压缩再使用,图片不要超过 1M,建议在 **500K**左右,**越小越好**。你可以使用下面这个免费的在线压缩工具:

- [https://redketchup.io/image-compressor](https://redketchup.io/image-compressor)

### 2.3 格式化代码

提交前请先格式化代码再提交:

```
npm run format
```

## 3. 访问链接

- [https://njtustas.github.io](https://njtustas.github.io)
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
presets: [require.resolve("@docusaurus/core/lib/babel/preset")],
presets: [require.resolve("@docusaurus/core/lib/babel/preset")]
};
60 changes: 30 additions & 30 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ const config = {
projectName: "njtustas.github.io",

onBrokenLinks: "throw",
onBrokenMarkdownLinks: "warn",
onBrokenMarkdownLinks: "throw",

i18n: {
defaultLocale: "zh-Hans",
locales: ["zh-Hans"],
locales: ["zh-Hans"]
},

presets: [
Expand All @@ -30,18 +30,18 @@ const config = {
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
sidebarPath: require.resolve("./sidebars.js"),
sidebarPath: require.resolve("./sidebars.js")
},
blog: {
showReadingTime: true,
blogSidebarTitle: "所有文章",
blogSidebarCount: "ALL",
blogSidebarCount: "ALL"
},
theme: {
customCss: require.resolve("./src/css/custom.css"),
},
}),
],
customCss: require.resolve("./src/css/custom.css")
}
})
]
],

themeConfig:
Expand All @@ -52,26 +52,26 @@ const config = {
title: "技术开发部",
logo: {
alt: "logo",
src: "favicon.ico",
src: "favicon.ico"
},
items: [
{
type: "docSidebar",
sidebarId: "docs",
position: "left",
label: "部门文档",
label: "部门文档"
},
{
to: "/blog",
label: "动态文章",
position: "left",
position: "left"
},
{
href: "https://github.com/NJTUSTAS/njtustas.github.io",
label: "GitHub",
position: "right",
},
],
position: "right"
}
]
},
footer: {
style: "dark",
Expand All @@ -81,44 +81,44 @@ const config = {
items: [
{
label: "电子组文档",
to: "/docs/electronics/intro",
},
],
to: "/docs/electronics/intro"
}
]
},
{
title: "资源",
items: [
{
label: "南工OJ",
href: "https://acm.online.njtech.edu.cn",
href: "https://acm.online.njtech.edu.cn"
},
{
label: "值班笔记",
href: "https://punch.mraddict.top",
},
],
href: "https://punch.mraddict.top"
}
]
},
{
title: "友链",
items: [
{
label: "远景实验室",
href: "https://www.vistalab.top",
href: "https://www.vistalab.top"
},
{
label: "Mars工作室",
href: "https://marsstudio.vercel.app",
},
],
},
href: "https://studio.online.njtech.edu.cn"
}
]
}
],
copyright: `Copyright © ${new Date().getFullYear()} 校大学生科协. All rights reversed.`,
copyright: `Copyright © ${new Date().getFullYear()} 校大学生科协. All rights reversed.`
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
},
}),
darkTheme: darkCodeTheme
}
})
};

module.exports = config;
Binary file added images/markdown-plugin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
"serve": "docusaurus serve",
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids",
"typecheck": "tsc"
"typecheck": "tsc",
"lint": "prettier --plugin-search-dir . --check .",
"format": "prettier --plugin-search-dir . --write ."
},
"dependencies": {
"@docusaurus/core": "2.4.0",
Expand All @@ -26,6 +28,7 @@
"devDependencies": {
"@docusaurus/module-type-aliases": "2.4.0",
"@tsconfig/docusaurus": "^1.0.5",
"prettier": "^2.8.8",
"typescript": "^4.7.4"
},
"browserslist": {
Expand Down
Loading

0 comments on commit c955c9a

Please sign in to comment.