Skip to content

Commit

Permalink
feat(docs): markdown-it plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
dogodo-cc committed Apr 2, 2024
1 parent 5f4d128 commit 035b898
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 3 deletions.
10 changes: 10 additions & 0 deletions projects/document/docs/.vitepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { withMermaid } from 'vitepress-plugin-mermaid';
const config = defineConfig({
title: 'Cocos FE',
description: 'Cocos FE Team',
head: [['link', { rel: 'icon', href: '/favicon.ico' }]],
themeConfig: {
socialLinks: [
{
Expand Down Expand Up @@ -40,6 +41,15 @@ const config = defineConfig({
message: '',
copyright: 'MIT Licensed | Copyright © 2019-present cocos FE',
},

docFooter: {
prev: '上一篇',
next: '下一篇',
},

outline: {
label: '摘要',
},
},
lastUpdated: false,
vite: {
Expand Down
2 changes: 1 addition & 1 deletion projects/document/docs/core/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

前端的基础建设都在这边沉淀。我们使用 `mono-repo` 的管理方式,将所有公共包都集中在一个仓库里维护。

所有 npm 包都以 `@cocos-fe/` 为前缀,更有组织性和辨识度。
所有 npm 包都以 `@cocos-fe/` 为前缀,更有组织性和辨识度。
4 changes: 2 additions & 2 deletions projects/document/docs/docs/index.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

# 文档中心

## 文档

文档中心,欢迎大家把梳理好的文档贡献到这边

## 踩坑记录

把踩过的坑,碰过的壁都记录在这边,避免其他人重蹈覆辙。
把踩过的坑,碰过的壁都记录在这边,避免其他人重蹈覆辙。
37 changes: 37 additions & 0 deletions projects/document/docs/note/markdown/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[markdown-it](https://github.com/markdown-it/markdown-it)
[markdown-it-doc](https://github.com/markdown-it/markdown-it/tree/master/docs)
[markdown-it-doc-zh](https://markdown-it.docschina.org/#%E5%AE%89%E8%A3%85)

[markdown-it-container](https://github.com/markdown-it/markdown-it-container)
[拓展 fence 的案例](https://github.com/emersonbottero/vitepress-plugin-mermaid)

[markdown 中文官方教程](https://markdown.com.cn/)

::: yueyue
2024-04-02
:::

```js
import markdownItContainer from 'markdown-it-container';

markdown: {
config: (md) => {
const name = 'yueyue';
md.use(markdownItContainer, name, {
validate: function (params) {
// return params.trim().match(/^yueyue\s+(.*)$/);
return params.trim() === name;
},
render: function (tokens, idx) {
const token = tokens[idx];
if (token.nesting === 1) {
return `<div class="yueyue-container" style="border: 1px solid #eee">\n`;
} else {
return '</div>\n';
}
},
});
},
},

```
1 change: 1 addition & 0 deletions projects/document/docs/note/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
这里存放不对外的笔记
Binary file added projects/document/docs/public/favicon.ico
Binary file not shown.

0 comments on commit 035b898

Please sign in to comment.