2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Honkit で PlantUml を使う[Docker]

Last updated at Posted at 2020-10-21

やること

Honkit の導入記事はいくつかあったが、PlantUml を使えるようにするという記事はあまり見当たらなかったのでおいておく

サンプル

動作するコード
https://github.com/tktcorporation/honkit-uml-sample

Docker 周りの準備

package.json

{
  "name": "honkit_docker",
  "version": "1.0.0",
  "scripts": {
    "serve": "npx honkit serve",
    "build": "npx honkit build",
    "pdf": "npx honkit pdf"
  },
  "dependencies": {
    "gitbook-plugin-uml": "^1.0.3",
    "honkit": "^3.6.6"
  }
}

Dockerfile

FROM honkit/honkit

RUN apt-get update
# PlantUml のために追加インストール
RUN apt-get install -y build-essential openjdk-8-jre graphviz

WORKDIR /doc

COPY ./package.json ./package.json
RUN yarn

COPY . .

CMD [ "npx honkit build" ]

docker-compose.yml

version: "3.7"
services:
  doc:

    build: .
    restart: always
    working_dir: /doc
    volumes:
      - .:/doc:cached
      - /doc/node_modules
    ports:
      - "4000:4000"

コンテナに入る

$ docker-compose build
$ docker-compose run --service-ports doc /bin/bash

以降は特に断りのない限りコンテナ内での作業とする。

Honkit 導入

book.json

{
  "plugins": [
    "uml"
  ]
}

init

$ honkit init

uml を書く


# UML Sample
```uml
@startuml

actor Promoter
actor Entrant

Promoter --> (Create Event)
Promoter -> (Attend Event)

Entrant --> (Find Event)
(Attend Event) <- Entrant

(Attend Event) <.. (Create Member)  : <<include>>

@enduml

serve

$ npx honkit serve

localhost:4000 で plantuml .

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?