Skip to content

Commit 8b346ac

Browse files
authored
Use mermaid-filter (#208)
1 parent 4d6498d commit 8b346ac

File tree

4 files changed

+57
-7
lines changed

4 files changed

+57
-7
lines changed

.github/workflows/GHPages.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ jobs:
1010
steps:
1111
- uses: actions/checkout@v4
1212
- uses: actions/setup-node@v4
13-
- uses: docker://pandoc/latex:2.9
13+
- uses: docker://pandoc/latex:2.19
1414
with:
15-
args: |
16-
sh build-resources-with-pandoc.sh
15+
entrypoint: "/bin/sh"
16+
args: "./build-resources-with-pandoc.sh"
1717
- name: Install Packages
1818
run: |
1919
npm i -f

.github/workflows/test-build-resources-with-pandoc.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,20 @@ jobs:
1414
steps:
1515
- uses: actions/checkout@v4
1616
- uses: actions/setup-node@v4
17-
- uses: docker://pandoc/latex:2.9
17+
- uses: docker://pandoc/latex:2.19
1818
with:
19-
args: sh build-resources-with-pandoc.sh
19+
entrypoint: "/bin/sh"
20+
args: "./build-resources-with-pandoc.sh"
2021
- name: Archive resources
2122
uses: actions/upload-artifact@v4
2223
with:
2324
name: pandoc_resources
2425
path: ./public/resources/
2526
retention-days: 1
27+
- name: Archive Error resources
28+
if: failure()
29+
uses: actions/upload-artifact@v4
30+
with:
31+
name: error_resources
32+
path: ./documents/
33+
retention-days: 1

.puppeteer.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"args": ["--no-sandbox", "--disable-setuid-sandbox"],
3+
"executablePath": "/usr/bin/chromium-browser"
4+
}

build-resources-with-pandoc.sh

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,46 @@
1+
#!/bin/sh
2+
set -e
3+
14
ROOT_DIR=`pwd`
25
CSS_PATH="${ROOT_DIR}/documents/common/pandoc_styles/css/style.css"
36
STYLE_DOCX_PATH="${ROOT_DIR}/documents/common/pandoc_styles/スタイル.docx"
47
RESOURCES_DIR="${ROOT_DIR}/public/resources"
58

9+
# バージョンチェック
10+
cat /etc/alpine-release
11+
12+
apk update
13+
14+
# apkによるインストール
15+
## chromium のインストール
16+
apk add --update chromium
17+
18+
## nodejs のインストール
19+
apk add nodejs npm
20+
21+
## 日本語用フォントのインストール
22+
apk add --no-cache curl fontconfig
23+
curl -O https://moji.or.jp/wp-content/ipafont/IPAexfont/IPAexfont00301.zip
24+
mkdir -p /usr/share/fonts/ipa
25+
mkdir -p /temp
26+
unzip IPAexfont00301.zip -d /temp
27+
cp /temp/IPAexfont00301/*.ttf /usr/share/fonts/ipa/
28+
rm IPAexfont00301.zip
29+
30+
# バージョンチェック
31+
node -v
32+
npm -v
33+
chromium-browser --version
34+
35+
# mermaid-filterに必要な変数をセット
36+
export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD='true'
37+
export MERMAID_FILTER_PUPPETEER_CONFIG="${ROOT_DIR}/.puppeteer.json"
38+
export PUPPETEER_EXECUTABLE_PATH="/usr/bin/chromium-browser"
39+
# export MERMAID_FILTER_FORMAT="svg" # docxでの出力時にはsvgは使えません
40+
41+
# mermaid-filterのインストール
42+
43+
644
# Java
745
cd ${ROOT_DIR}/documents/forJava
846

@@ -26,8 +64,8 @@ pandoc ./AWSインフラリソース命名規約.md --toc --reference-doc=${STYL
2664
# OpenAPISpecification
2765
cd ${ROOT_DIR}/documents/forOpenAPISpecification
2866

29-
pandoc ./OpenAPI_Specification_3.0.3.md -s --self-contained --number-sections --toc -t html5 -c ${CSS_PATH} -o ${RESOURCES_DIR}/OpenAPI_Specification_3.0.3.html
30-
pandoc ./OpenAPI_Specification_3.0.3.md --toc --reference-doc=${STYLE_DOCX_PATH} -s -o ${RESOURCES_DIR}/OpenAPI_Specification_3.0.3.docx
67+
pandoc ./OpenAPI_Specification_3.0.3.md -s --self-contained --number-sections --toc -t html5 -c ${CSS_PATH} --filter mermaid-filter -o ${RESOURCES_DIR}/OpenAPI_Specification_3.0.3.html
68+
pandoc ./OpenAPI_Specification_3.0.3.md --toc --reference-doc=${STYLE_DOCX_PATH} -s --filter mermaid-filter -o ${RESOURCES_DIR}/OpenAPI_Specification_3.0.3.docx
3169

3270
# Git
3371
cd ${ROOT_DIR}/documents/forGitBranch

0 commit comments

Comments
 (0)