Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use mermaid-filter #208

Merged
merged 1 commit into from
Dec 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/GHPages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: docker://pandoc/latex:2.9
- uses: docker://pandoc/latex:2.19
with:
args: |
sh build-resources-with-pandoc.sh
entrypoint: "/bin/sh"
args: "./build-resources-with-pandoc.sh"
- name: Install Packages
run: |
npm i -f
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/test-build-resources-with-pandoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,20 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: docker://pandoc/latex:2.9
- uses: docker://pandoc/latex:2.19
with:
args: sh build-resources-with-pandoc.sh
entrypoint: "/bin/sh"
args: "./build-resources-with-pandoc.sh"
- name: Archive resources
uses: actions/upload-artifact@v4
with:
name: pandoc_resources
path: ./public/resources/
retention-days: 1
- name: Archive Error resources
if: failure()
uses: actions/upload-artifact@v4
with:
name: error_resources
path: ./documents/
retention-days: 1
4 changes: 4 additions & 0 deletions .puppeteer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"args": ["--no-sandbox", "--disable-setuid-sandbox"],
"executablePath": "/usr/bin/chromium-browser"
Comment on lines +2 to +3
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

こんな設定ファイルがあったんですね..!!

}
42 changes: 40 additions & 2 deletions build-resources-with-pandoc.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,46 @@
#!/bin/sh
set -e

ROOT_DIR=`pwd`
CSS_PATH="${ROOT_DIR}/documents/common/pandoc_styles/css/style.css"
STYLE_DOCX_PATH="${ROOT_DIR}/documents/common/pandoc_styles/スタイル.docx"
RESOURCES_DIR="${ROOT_DIR}/public/resources"

# バージョンチェック
cat /etc/alpine-release

apk update

# apkによるインストール
## chromium のインストール
apk add --update chromium

## nodejs のインストール
apk add nodejs npm

## 日本語用フォントのインストール
apk add --no-cache curl fontconfig
curl -O https://moji.or.jp/wp-content/ipafont/IPAexfont/IPAexfont00301.zip
mkdir -p /usr/share/fonts/ipa
mkdir -p /temp
unzip IPAexfont00301.zip -d /temp
cp /temp/IPAexfont00301/*.ttf /usr/share/fonts/ipa/
rm IPAexfont00301.zip
Comment on lines +21 to +28
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

すごすぎる..!! 🚀


# バージョンチェック
node -v
npm -v
chromium-browser --version

# mermaid-filterに必要な変数をセット
export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD='true'
export MERMAID_FILTER_PUPPETEER_CONFIG="${ROOT_DIR}/.puppeteer.json"
export PUPPETEER_EXECUTABLE_PATH="/usr/bin/chromium-browser"
# export MERMAID_FILTER_FORMAT="svg" # docxでの出力時にはsvgは使えません

# mermaid-filterのインストール
npm i -g [email protected]

# Java
cd ${ROOT_DIR}/documents/forJava

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

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
pandoc ./OpenAPI_Specification_3.0.3.md --toc --reference-doc=${STYLE_DOCX_PATH} -s -o ${RESOURCES_DIR}/OpenAPI_Specification_3.0.3.docx
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
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

# Git
cd ${ROOT_DIR}/documents/forGitBranch
Expand Down
Loading