Skip to content

d7z-team/asciidoc-static-pages

Repository files navigation

Asciidoc HTML 文档生成器

Dragon’s Zone Team 专用的 HTML 文档生成器

入门

编辑配置文件

在项目根目录编辑文件 .pages.yaml ,填入以下配置

pages:
  info: # 网页信息
    title: "AsciiDoc Builder" # 项目标题
    home: 'https://github.com/d7z-team/asciidoc-static-pages' # 项目主页
  location: # 配置路径
    root: '/docs' # 文档根目录(相对于此文件所在的目录)
    menu: '/MENU.adoc' # 菜单文档(相对于文档根目录)
    main: '/MAIN.adoc' # 主页文档(相对于文档根目录)
    icon: '/assets/icon/logo.svg' # 图标(相对于文档根目录)
    style: '/dark.css' # 自定义 CSS(相对于文档根目录)
    script: '/user.js' # 自定义 JS(相对于文档根目录)
    output: '/public' # 编译输出目录 (相对于此文件所在的目录)
  conf: # 功能配置
    source_url: 'https://github.com/d7z-team/asciidoc-static-pages/tree/{{file.commit.id}}/' #源码路径拼接
    attr_ext: # 变量注入的文件后缀
      - adoc
      - sh
      - txt
      - yaml
      - yml
    doc_ext: # 识别为 asciidoc 文档的后缀
      - adoc
      - asciidoc
  attr: # 文档变量,注意,此内容同时会加载至 asciidoctor 的 attr 配置中
    - key=value
  attr_files:
    - value.properties # 变量外部文件链接,仅支持单行 key=value 的形式!

使用 Github Action

编辑文件 .github/workflows/gh-pages.yml,填入以下内容

name: GitHub Pages

on:
  push:
    branches:
      - main
  pull_request:

jobs:
  deploy:
    runs-on: ubuntu-20.04
    container: ghcr.io/d7z-team/asciidoc-static-pages:v2
    permissions:
      contents: write
    concurrency:
      group: ${{ github.workflow }}-${{ github.ref }}
    steps:
      - uses: actions/checkout@v3
        with:
          submodules: true
          fetch-depth: 0
      - name: 编译项目
        run: |
          git config --global --add safe.directory "$(pwd)"
          pages -O public
      - name: 发布 Web 页面
        uses: peaceiris/actions-gh-pages@v3
        if: ${{ github.ref == 'refs/heads/main' }}
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./public
          cname: '<请填入域名信息>'

最后提交即可。

使用 Gitlab

编辑文件 .gitlab-ci.yml,填入如下内容:

pages:
  image:
    name: ghcr.io/d7z-team/asciidoc-static-pages:v2
  script:
    - git checkout -b pages
    - pages --output public
  artifacts:
    paths:
      - public
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH

最后提交文件即可. 如果遇到无法获取 git commit id 的问题,请在 流水线通用设置 中修改为如下配置:

gitlab ci pipline

示例网站

LICENSE

注意: AsciiDoc 归属于 Eclipse Foundation,此项目使用 asciidoctor 命令渲染 .adoc 文件。

如无其他说明,此项目使用 MIT License 发布。

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages