Skip to content

Commit 973813f

Browse files
authored
Use VitePress (#185)
* Use VitePress * fix ci name * fix head.meta
1 parent b11d3b1 commit 973813f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1654
-509
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// Set *default* container specific settings.json values on container create.
1212
"settings": {
1313
"eslint.validate": ["javascript", "javascriptreact", "vue"],
14-
"eslint.workingDirectories": ["./", "./.vuepress"],
14+
"eslint.workingDirectories": ["./", "./.vitepress"],
1515
"editor.codeActionsOnSave": {
1616
"source.fixAll.eslint": true
1717
}

.github/workflows/GHPages.yml

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,41 +10,39 @@ jobs:
1010
steps:
1111
- uses: actions/checkout@v4
1212
- uses: actions/setup-node@v4
13-
with:
14-
node-version: 14
1513
- uses: docker://pandoc/latex:2.9
1614
with:
17-
args: "pandoc ./documents/forJava/Javaコーディング規約.md -s --self-contained --number-sections --toc -t html5 -c ./documents/common/pandoc_styles/css/style.css -o ./.vuepress/public/resources/Javaコーディング規約.html"
15+
args: "pandoc ./documents/forJava/Javaコーディング規約.md -s --self-contained --number-sections --toc -t html5 -c ./documents/common/pandoc_styles/css/style.css -o ./public/resources/Javaコーディング規約.html"
1816
- uses: docker://pandoc/latex:2.9
1917
with:
20-
args: "pandoc ./documents/forJava/Javaコーディング規約.md --toc --reference-doc=./documents/common/pandoc_styles/スタイル.docx -s -o ./.vuepress/public/resources/Javaコーディング規約.docx"
18+
args: "pandoc ./documents/forJava/Javaコーディング規約.md --toc --reference-doc=./documents/common/pandoc_styles/スタイル.docx -s -o ./public/resources/Javaコーディング規約.docx"
2119
- uses: docker://pandoc/latex:2.9
2220
with:
23-
args: "pandoc ./documents/forSQL/SQLコーディング規約(Oracle).md -s --self-contained --number-sections --toc -t html5 -c ./documents/common/pandoc_styles/css/style.css -o ./.vuepress/public/resources/SQLコーディング規約(Oracle).html"
21+
args: "pandoc ./documents/forSQL/SQLコーディング規約(Oracle).md -s --self-contained --number-sections --toc -t html5 -c ./documents/common/pandoc_styles/css/style.css -o ./public/resources/SQLコーディング規約(Oracle).html"
2422
- uses: docker://pandoc/latex:2.9
2523
with:
26-
args: "pandoc ./documents/forSQL/SQLコーディング規約(Oracle).md --toc --reference-doc=./documents/common/pandoc_styles/スタイル.docx -s -o ./.vuepress/public/resources/SQLコーディング規約(Oracle).docx"
24+
args: "pandoc ./documents/forSQL/SQLコーディング規約(Oracle).md --toc --reference-doc=./documents/common/pandoc_styles/スタイル.docx -s -o ./public/resources/SQLコーディング規約(Oracle).docx"
2725
- uses: docker://pandoc/latex:2.9
2826
with:
29-
args: "pandoc ./documents/forSQL/SQLコーディング規約(PostgreSQL).md -s --self-contained --number-sections --toc -t html5 -c ./documents/common/pandoc_styles/css/style.css -o ./.vuepress/public/resources/SQLコーディング規約(PostgreSQL).html"
27+
args: "pandoc ./documents/forSQL/SQLコーディング規約(PostgreSQL).md -s --self-contained --number-sections --toc -t html5 -c ./documents/common/pandoc_styles/css/style.css -o ./public/resources/SQLコーディング規約(PostgreSQL).html"
3028
- uses: docker://pandoc/latex:2.9
3129
with:
32-
args: "pandoc ./documents/forSQL/SQLコーディング規約(PostgreSQL).md --toc --reference-doc=./documents/common/pandoc_styles/スタイル.docx -s -o ./.vuepress/public/resources/SQLコーディング規約(PostgreSQL).docx"
30+
args: "pandoc ./documents/forSQL/SQLコーディング規約(PostgreSQL).md --toc --reference-doc=./documents/common/pandoc_styles/スタイル.docx -s -o ./public/resources/SQLコーディング規約(PostgreSQL).docx"
3331
- uses: docker://pandoc/latex:2.9
3432
with:
35-
args: "pandoc ./documents/forAWSResource/AWSインフラリソース命名規約.md -s --self-contained --number-sections --toc -t html5 -c ./documents/common/pandoc_styles/css/style.css -o ./.vuepress/public/resources/AWSインフラリソース命名規約.html"
33+
args: "pandoc ./documents/forAWSResource/AWSインフラリソース命名規約.md -s --self-contained --number-sections --toc -t html5 -c ./documents/common/pandoc_styles/css/style.css -o ./public/resources/AWSインフラリソース命名規約.html"
3634
- uses: docker://pandoc/latex:2.9
3735
with:
38-
args: "pandoc ./documents/forAWSResource/AWSインフラリソース命名規約.md --toc --reference-doc=./documents/common/pandoc_styles/スタイル.docx -s -o ./.vuepress/public/resources/AWSインフラリソース命名規約.docx"
36+
args: "pandoc ./documents/forAWSResource/AWSインフラリソース命名規約.md --toc --reference-doc=./documents/common/pandoc_styles/スタイル.docx -s -o ./public/resources/AWSインフラリソース命名規約.docx"
3937
- uses: docker://pandoc/latex:2.9
4038
with:
41-
args: "pandoc ./documents/forOpenAPISpecification/OpenAPI_Specification_2.0.md -s --self-contained --number-sections --toc -t html5 -c ./documents/common/pandoc_styles/css/style.css -o ./.vuepress/public/resources/OpenAPI_Specification_2.0.html"
39+
args: "pandoc ./documents/forOpenAPISpecification/OpenAPI_Specification_2.0.md -s --self-contained --number-sections --toc -t html5 -c ./documents/common/pandoc_styles/css/style.css -o ./public/resources/OpenAPI_Specification_2.0.html"
4240
- uses: docker://pandoc/latex:2.9
4341
with:
44-
args: "pandoc ./documents/forOpenAPISpecification/OpenAPI_Specification_2.0.md --toc --reference-doc=./documents/common/pandoc_styles/スタイル.docx -s -o ./.vuepress/public/resources/OpenAPI_Specification_2.0.docx"
42+
args: "pandoc ./documents/forOpenAPISpecification/OpenAPI_Specification_2.0.md --toc --reference-doc=./documents/common/pandoc_styles/スタイル.docx -s -o ./public/resources/OpenAPI_Specification_2.0.docx"
4543
- name: Install Packages
4644
run: |
47-
npm i --legacy-peer-deps
45+
npm i -f
4846
npm i --global mermaid-filter
4947
- name: Build all
5048
run: |

.github/workflows/ci.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: ci
2+
3+
on:
4+
pull_request:
5+
branches: [master]
6+
7+
jobs:
8+
build-docs:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-node@v4
13+
- name: Install Packages
14+
run: |
15+
npm i -f
16+
- name: Build all
17+
run: |
18+
npm run build

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ node_modules
66

77
# WSL
88
*:Zone.Identifier
9+
10+
/.vitepress/cache

.vuepress/config.js renamed to .vitepress/config.mjs

Lines changed: 131 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,152 @@
1-
"use strict";
1+
import { fileURLToPath } from "url";
2+
import { defineConfig as defineConfigBase } from "vitepress";
3+
import { withMermaid } from "vitepress-plugin-mermaid";
4+
import { Module } from "module";
5+
import markdownItTaskLists from "markdown-it-task-lists";
6+
import markdownItFootnote from "markdown-it-footnote";
7+
import markdownItHeaderShift from "./lib/markdown-it-plugin-header-shift.mjs";
8+
import * as plantumlLanguage from "./lib/plantuml.tmlanguage.mjs";
9+
const __filename = fileURLToPath(import.meta.url);
10+
const pkg = Module.createRequire(__filename)("../package.json");
211

12+
const repoUrl = pkg.repository.url
13+
.replace(/\.git$/u, "")
14+
.replace(/^git\+/u, "");
15+
16+
/** @type {import("vitepress").DefaultTheme.Sidebar} */
317
const links = {
4-
"/documents/forJava/Javaコーディング規約_for_11.html": [
5-
"/documents/forJava/",
6-
"/documents/forJava/Javaコーディング規約.html",
7-
"/documents/forJava/Javaコーディング規約_for_11.html",
8-
],
9-
"/documents/forJava/Javaコーディング規約_for_8.html": [
10-
"/documents/forJava/",
11-
"/documents/forJava/Javaコーディング規約.html",
12-
"/documents/forJava/Javaコーディング規約_for_8.html",
13-
],
1418
"/documents/forJava/": [
15-
"/documents/forJava/",
16-
"/documents/forJava/Javaコーディング規約.html",
19+
{ text: "Home", link: "/documents/forJava/" },
20+
{
21+
text: "Javaコーディング規約",
22+
link: "/documents/forJava/Javaコーディング規約.html",
23+
},
24+
{
25+
text: "For Java11",
26+
link: "/documents/forJava/Javaコーディング規約_for_11.html",
27+
},
28+
{
29+
text: "For Java8",
30+
link: "/documents/forJava/Javaコーディング規約_for_8.html",
31+
},
1732
],
1833
"/documents/forSQL/": [
19-
"/documents/forSQL/",
20-
"/documents/forSQL/SQLコーディング規約(Oracle).html",
21-
"/documents/forSQL/SQLコーディング規約(PostgreSQL).html",
34+
{ text: "Home", link: "/documents/forSQL/" },
35+
{
36+
text: "SQLコーディング規約(PostgreSQL)",
37+
link: "/documents/forSQL/SQLコーディング規約(PostgreSQL).html",
38+
},
39+
{
40+
text: "SQLコーディング規約(Oracle)",
41+
link: "/documents/forSQL/SQLコーディング規約(Oracle).html",
42+
},
2243
],
2344
"/documents/forAWSResource/": [
24-
"/documents/forAWSResource/",
25-
"/documents/forAWSResource/AWSインフラリソース命名規約.html",
45+
{ text: "Home", link: "/documents/forAWSResource/" },
46+
{
47+
text: "AWSインフラ命名規約",
48+
link: "/documents/forAWSResource/AWSインフラリソース命名規約.html",
49+
},
2650
],
2751
"/documents/forOpenAPISpecification/": [
28-
"/documents/forOpenAPISpecification/",
29-
"/documents/forOpenAPISpecification/OpenAPI_Specification_2.0.html",
30-
"/documents/forOpenAPISpecification/OpenAPI_Specification_3.0.3.html",
52+
{ text: "Home", link: "/documents/forOpenAPISpecification/" },
53+
{
54+
text: "OpenAPI Specification 2.0規約",
55+
link: "/documents/forOpenAPISpecification/OpenAPI_Specification_2.0.html",
56+
},
57+
{
58+
text: "OpenAPI Specification 3.0.3規約",
59+
link: "/documents/forOpenAPISpecification/OpenAPI_Specification_3.0.3.html",
60+
},
3161
],
3262
"/documents/forGitBranch/": [
33-
"/documents/forGitBranch/",
34-
"/documents/forGitBranch/git_branch_standards.html",
35-
"/documents/forGitBranch/merge_develop_to_feature.html",
36-
"/documents/forGitBranch/merge_feature_to_develop.html",
37-
"/documents/forGitBranch/commit_message_rule.html",
38-
"/documents/forGitBranch/vscode_git_ope.html",
63+
{ text: "Home", link: "/documents/forGitBranch/" },
64+
{
65+
text: "Gitブランチフロー規約",
66+
link: "/documents/forGitBranch/git_branch_standards.html",
67+
},
68+
{
69+
text: "機能ブランチに開発ブランチの変更を取り込む方法",
70+
link: "/documents/forGitBranch/merge_develop_to_feature.html",
71+
},
72+
{
73+
text: "開発ブランチに機能ブランチの変更を取り込む方法",
74+
link: "/documents/forGitBranch/merge_feature_to_develop.html",
75+
},
76+
{
77+
text: "コミットメッセージ規約",
78+
link: "/documents/forGitBranch/commit_message_rule.html",
79+
},
80+
{
81+
text: "VSCode上でのGit操作",
82+
link: "/documents/forGitBranch/vscode_git_ope.html",
83+
},
3984
],
4085
"/documents/forSlack/": [
41-
"/documents/forSlack/",
42-
"/documents/forSlack/slack_usage_guidelines.html",
86+
{ text: "Home", link: "/documents/forSlack/" },
87+
{
88+
text: "Slack利用ガイドライン",
89+
link: "/documents/forSlack/slack_usage_guidelines.html",
90+
},
4391
],
4492
};
45-
console.log(links);
4693

47-
module.exports = {
48-
base: "/coding-standards/",
94+
/**
95+
* @typedef {import('vitepress').UserConfig<import('vitepress').DefaultTheme.Config>} VitepressConfig
96+
*/
97+
/**
98+
* @param {VitepressConfig} config config
99+
* @returns {VitepressConfig} config
100+
*/
101+
function defineConfig(config) {
102+
return withMermaid(defineConfigBase(config));
103+
}
104+
105+
export default defineConfig({
49106
title: "Future Enterprise Coding Standards",
50107
description:
51108
"フューチャー株式会社が作成するエンタープライズ領域に特化したコーディング規約",
52-
dest: "docs",
53-
serviceWorker: false,
109+
outDir: "docs",
110+
ignoreDeadLinks: "localhostLinks",
54111
markdown: {
55112
lineNumbers: true,
56-
extendMarkdown: (md) => {
57-
md.use(require("./markdown-it-plugin-header-shift"));
58-
md.use(require("markdown-it-task-lists"));
113+
config(md) {
114+
md.use(markdownItHeaderShift);
115+
md.use(markdownItTaskLists);
116+
md.use(markdownItFootnote);
59117
},
60-
plugins: ["vuepress-plugin-mermaidjs"],
118+
languages: [plantumlLanguage],
61119
},
62-
head: [],
63120
locales: {
64-
"/": {
121+
root: {
65122
lang: "ja",
66123
},
67124
},
68-
plugins: ["vuepress-plugin-mermaidjs"],
125+
head: [["link", { rel: "icon", href: `/coding-standards/logo.png` }]],
126+
srcExclude: ["./README.md"],
127+
base: "/coding-standards/",
69128
themeConfig: {
70-
logo: "/images/logo.svg",
71-
repo: "https://github.com/future-architect/coding-standards",
72-
docsRepo: "https://github.com/future-architect/coding-standards",
73-
docsBranch: "master",
74-
editLinks: true,
75-
lastUpdated: true,
129+
siteTitle: "Future Enterprise <wbr>Coding Standards",
130+
logo: {
131+
light: "/images/logo.svg",
132+
dark: "/images/logo-dark.svg",
133+
},
134+
footer: {
135+
copyright:
136+
"©2015 - 2024 Future Enterprise Coding Standards - Future Corporation",
137+
},
138+
search: {
139+
provider: "local",
140+
options: {
141+
detailedView: true,
142+
},
143+
},
144+
editLink: {
145+
pattern: repoUrl + "/edit/master/:path",
146+
},
147+
outline: {
148+
level: "deep",
149+
},
76150
nav: [
77151
{
78152
text: "Java",
@@ -167,7 +241,7 @@ module.exports = {
167241
},
168242
{
169243
text: "サンプルプロジェクト",
170-
link: "/documents/forGitBranch/future_muscle_partner/",
244+
link: "/documents/forMarkdown/future_muscle_partner/",
171245
},
172246
],
173247
},
@@ -216,6 +290,14 @@ module.exports = {
216290
],
217291
},
218292
],
293+
219294
sidebar: links,
295+
296+
socialLinks: [
297+
{
298+
icon: "github",
299+
link: repoUrl,
300+
},
301+
],
220302
},
221-
};
303+
});
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/**
22
* headerタグを1つづつずらします。
3-
* Pandocでも利用できるMarkdownファイルにしたいので、`# header`を一つしかつくれないvuepress制約がうまく共存できないため
4-
* vuepressではhタグの番号をずらし、無理やり共存できるようにします。
3+
* Pandocでも利用できるMarkdownファイルにしたいので、`# header`を一つしかつくれないvitepress制約がうまく共存できないため
4+
* vitepressではhタグの番号をずらし、無理やり共存できるようにします。
55
*/
6-
module.exports = function headerSections(md) {
6+
export default function headerSections(md) {
77
function shiftHeaders(state) {
88
state.tokens.forEach((t, i) => {
99
if (t.type.includes("heading")) {
@@ -13,4 +13,4 @@ module.exports = function headerSections(md) {
1313
}
1414

1515
md.core.ruler.push("header_shift", shiftHeaders);
16-
};
16+
}

0 commit comments

Comments
 (0)