Last active
December 17, 2025 05:43
-
-
Save Hogeyama/a2e7a3f787deef119a7942b0b498638c to your computer and use it in GitHub Desktop.
md2textile by pandoc, textile2md by orchitech/redmine_reformat microservice
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| init: | |
| #!/usr/bin/env -S bash -euo pipefail -o noclobber | |
| echo "[Generating Dockerfile...]" | |
| cat - > Dockerfile <<'EOF' | |
| FROM redmine:6.0.3 | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| pkg-config \ | |
| libxml2-dev \ | |
| libxslt1-dev \ | |
| libffi-dev \ | |
| libssl-dev \ | |
| zlib1g-dev \ | |
| ruby-dev \ | |
| curl \ | |
| && rm -rf /var/lib/apt/lists/* | |
| COPY entrypoint.sh /entrypoint.sh | |
| ENTRYPOINT ["/entrypoint.sh"] | |
| CMD ["rails", "server", "-b", "0.0.0.0"] | |
| EOF | |
| echo "[Generating compose.yaml...]" | |
| cat - > compose.yaml <<'EOF' | |
| services: | |
| redmine: | |
| build: . | |
| container_name: redmine | |
| ports: | |
| - "3030:3030" | |
| environment: | |
| BUNDLE_FORCE_RUBY_PLATFORM: true | |
| REDMINE_DB_MYSQL: redmine-db | |
| REDMINE_DB_PASSWORD: password | |
| volumes: | |
| - ./redmine_reformat:/usr/src/redmine/plugins/redmine_reformat | |
| - ./pandoc:/usr/bin/pandoc | |
| depends_on: | |
| - redmine-db | |
| healthcheck: | |
| test: ["CMD", "curl", "-f", "http://localhost:3030"] | |
| interval: 10s | |
| timeout: 10s | |
| retries: 10 | |
| redmine-db: | |
| image: mysql:5.7 | |
| container_name: redmine-db | |
| environment: | |
| MYSQL_ROOT_PASSWORD: password | |
| MYSQL_DATABASE: redmine | |
| command: mysqld --character-set-server=utf8 --collation-server=utf8_unicode_ci | |
| EOF | |
| echo "[Generating entrypoint.sh...]" | |
| cat - > entrypoint.sh <<'EOF' | |
| #!/bin/bash | |
| set -eu | |
| /docker-entrypoint.sh "$@" & | |
| # Redmine が完全に起動するまで待機 | |
| echo "[Waiting for Redmine to be ready...]" | |
| until curl -s -o /dev/null -w "%{http_code}" http://localhost:3000 | grep -q "200"; do | |
| sleep 5 | |
| done | |
| echo "[Redmine is ready! Running rake task...]" | |
| rake reformat:microservice | |
| EOF | |
| chmod +x entrypoint.sh | |
| echo "[Clone redmine_reformat plugin...]" | |
| git clone https://github.com/Hogeyama/redmine_reformat.git | |
| echo "[Fetching pandoc...]" | |
| wget -qO- https://github.com/jgm/pandoc/releases/download/3.6.3/pandoc-3.6.3-linux-amd64.tar.gz | | |
| tar xz --strip-components=2 pandoc-3.6.3/bin/pandoc | |
| echo "[Fetching pandoc-md2redmine...]" | |
| wget -qO pandoc-md2redmine https://github.com/Hogeyama/pandoc-md2redmine/releases/download/v0.1.0.0/pandoc-md2redmine-linux-amd64 | |
| chmod +x pandoc-md2redmine | |
| echo "[Building Docker image...]" | |
| docker compose build | |
| deinit: | |
| #!/usr/bin/env -S bash -euo pipefail -o noclobber | |
| docker compose down -v || true | |
| rm -rf redmine_reformat pandoc Dockerfile compose.yaml entrypoint.sh | |
| start-server: | |
| #!/usr/bin/env -S bash -euo pipefail -o noclobber | |
| echo "[Starting server. This may take about 1min...]" | |
| docker compose up --build --wait | |
| textile2md: | |
| #!/usr/bin/env -S bash -euo pipefail -o noclobber | |
| curl -fsS -X PUT -H 'Content-Type: text/plain' --data-binary @- \ | |
| 'http://localhost:3030?to_formatting=common_mark&from_formatting=textile' | |
| md2textile: | |
| #!/usr/bin/env -S bash -euo pipefail -o noclobber | |
| ./pandoc-md2redmine |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
md2textile and textile2md
Requirements
Setup
Redmine Textile to Markdown
Output:
Markdown to Redmine Textile
Output: