Skip to content

aYukiYoshida/tips

Repository files navigation

TIPS

Link to deployed page

Click to me !!

Requirements

Setup

  1. Derive source code

    git clone git@github.com:aYukiYoshida/tips.git
  2. Install packages

    mise install
  3. Install dependencies

    mise run setup

Commands

for mkdocs

For full documentation visit mkdocs.org.

  • Create a new project

    poetry run mkdocs new [dir-name]
  • Start the live-reloading docs server

    poetry run mkdocs serve
  • Build the documentation site.

    poetry run mkdocs build
  • Deploy the built documentation site on Github Pages.

    poetry run mkdocs gh-deploy
  • Print help message and exit.

    poetry run mkdocs -h

for Zenn

  • Create a new project (only at first time; not required)

    npx zenn init
  • Create a new article

    npx zenn new:article
  • Start the live-reloading docs server

    npx zenn preview --port 3000

for Qiita

The following commands for Qiita do not need to be executed manually because the articles of Qiita are managed by the GitHub Actions. These are provided for reference only.

  • Create a new project (only at first time; not required)

    npx qiita init
  • Create a new article

    npx qiita new <BASE_NAME>
  • Start the live-reloading docs server

    npx qiita preview

Project Layout

mkdocs.yml    # The configuration file.
docs/         # Articles for MkDocs
    index.md  # The documentation homepage.
    ...       # Other markdown pages, images and other files.
articles      # Articles for Zenn
books         # Books for Zenn
public        # Articles for Qiita

Sync Articles between Zenn and Qiita

Workflow

  1. Zenn の記事を新規に作成する。もしくは、既存の記事を更新する。
  2. Zenn の記事の新規作成もしくは、更新についてコミットする。
  3. 前述のコミットを main ブランチに push する。
  4. main ブランチでの変更が検知され Zenn が提供する機能により自動でデプロイされる。
  5. main ブランチでの変更により sync-articles-from-zenn-to-qiita のワークフローが実行される。以下の処理が実行される。
    1. Zenn の記事が Qiita に変換する。
    2. 同期する Qiita の記事が存在しない場合は、新規に作成され、その id が Zenn の記事の末尾に追記される。この Zenn の記事の変更について、コミットする。
    3. 新規作成もしくは、更新によらず Qiita の記事の変更について、コミットする。
    4. Qiita の記事を公開する。このとき Qiita CLI により front matter が更新される。この Qiita の記事の変更については、自動でコミットされる。

Convert Article Command

  • Convert article of Zenn to that of Qiita

    npm run z2q <ARTICLE_ID>

Guide