├── .dockerignore
├── .editorconfig
├── .github
├── ISSUE_TEMPLATE
│ ├── bug_report.yml
│ ├── config.yml
│ ├── documentation.yml
│ └── feature_request.yml
├── contributing.md
├── dependabot.yml
├── pull_request_template.md
└── workflows
│ ├── codeql.yml
│ ├── docker.yml
│ └── go.yml
├── .gitignore
├── .golangci.yml
├── CODEOWNERS
├── Dockerfile
├── LICENSE
├── README.md
├── Taskfile.yml
├── conf
├── app.ini
├── embed.go
└── locale
│ ├── embed.go
│ ├── locale_en-US.ini
│ └── locale_zh-CN.ini
├── docs
├── assets
│ └── github-webhook.jpg
├── dev
│ ├── local_development.md
│ └── new_release.md
├── en-US
│ ├── howto
│ │ ├── README.md
│ │ ├── configure-reverse-proxy.md
│ │ ├── customize-templates.md
│ │ ├── run-through-docker.md
│ │ ├── set-up-documentation.md
│ │ ├── sync-through-webhook.md
│ │ ├── use-extensions.md
│ │ └── write-document.md
│ └── introduction
│ │ ├── README.md
│ │ ├── installation.md
│ │ └── quick-start.md
├── toc.ini
└── zh-CN
│ ├── howto
│ ├── README.md
│ ├── configure-reverse-proxy.md
│ ├── customize-templates.md
│ ├── run-through-docker.md
│ ├── set-up-documentation.md
│ ├── sync-through-webhook.md
│ ├── use-extensions.md
│ └── write-document.md
│ └── introduction
│ ├── README.md
│ ├── installation.md
│ └── quick-start.md
├── go.mod
├── go.sum
├── internal
├── cmd
│ ├── cmd.go
│ └── web.go
├── conf
│ ├── conf.go
│ └── static.go
├── osutil
│ ├── osutil.go
│ └── osutil_test.go
└── store
│ ├── markdown.go
│ ├── markdown_test.go
│ ├── store.go
│ └── toc.go
├── main.go
├── public
├── css
│ └── main.css
├── embed.go
└── img
│ ├── asouldocs-dark.png
│ ├── asouldocs-light.png
│ └── favicon.png
├── tailwind.config.js
└── templates
├── 404.html
├── common
├── head.html
└── navbar.html
├── docs
├── navbar.html
└── page.html
├── embed.go
└── home.html
/.dockerignore:
--------------------------------------------------------------------------------
1 | .github/
2 | .dockerignore
3 | *.yml
4 | !Taskfile.yml
5 | *.md
6 | .editorconfig
7 | .gitignore
8 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # http://editorconfig.org
2 |
3 | root = true
4 |
5 | [*]
6 | charset = utf-8
7 | end_of_line = lf
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
11 | [*.{html, css, yml}]
12 | indent_style = space
13 | indent_size = 2
14 |
15 | [*.js]
16 | indent_size = 2
17 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.yml:
--------------------------------------------------------------------------------
1 | name: Bug report
2 | description: File a bug report to help us improve
3 | labels: ["\U0001F48A bug"]
4 | body:
5 | - type: markdown
6 | attributes:
7 | value: |
8 | Thanks for taking the time to fill out this bug report!
9 |
10 | - Please use English :)
11 | - For questions, ask in [Discussions](https://github.com/asoul-sig/asouldocs/discussions).
12 | - Before you file an issue read the [Contributing guide](https://github.com/asoul-sig/asouldocs/blob/main/.github/contributing.md).
13 | - Check to make sure someone hasn't already opened a similar [issue](https://github.com/asoul-sig/asouldocs/issues).
14 | - type: input
15 | attributes:
16 | label: Version
17 | description: |
18 | Please specify the exact version you're reporting for, e.g. "1.0.0".
19 |
20 | _Note that "unknwon/asouldocs:latest" is not a valid version, it does not mean anything._
21 | validations:
22 | required: true
23 | - type: input
24 | attributes:
25 | label: Operating system
26 | description: |
27 | Please specify the exact operating system name and version you're reporting for, e.g. "Windows 10", "CentOS 7", "Ubuntu 20.04".
28 | validations:
29 | required: true
30 | - type: textarea
31 | attributes:
32 | label: Describe the bug
33 | description: A clear and concise description of what the bug is.
34 | validations:
35 | required: true
36 | - type: textarea
37 | attributes:
38 | label: To reproduce
39 | description: The steps to reproduce the problem described above.
40 | validations:
41 | required: true
42 | - type: textarea
43 | attributes:
44 | label: Expected behavior
45 | description: A clear and concise description of what you expected to happen.
46 | validations:
47 | required: true
48 | - type: textarea
49 | attributes:
50 | label: Additional context
51 | description: |
52 | Links? References? Suggestions? Anything that will give us more context about the issue you are encountering!
53 |
54 | Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
55 | validations:
56 | required: false
57 | - type: checkboxes
58 | attributes:
59 | label: Code of Conduct
60 | description: By submitting this issue, you agree to follow our [Code of Conduct](https://go.dev/conduct)
61 | options:
62 | - label: I agree to follow this project's Code of Conduct
63 | required: true
64 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/config.yml:
--------------------------------------------------------------------------------
1 | blank_issues_enabled: false
2 | contact_links:
3 | - name: Ask questions
4 | url: https://github.com/asoul-sig/asouldocs/discussions
5 | about: Please ask questions in Discussions.
6 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/documentation.yml:
--------------------------------------------------------------------------------
1 | name: Improve documentation
2 | description: Suggest an idea or a patch for documentation
3 | labels: ["📖 documentation"]
4 | body:
5 | - type: markdown
6 | attributes:
7 | value: |
8 | Thanks for taking the time to fill out this form!
9 |
10 | - Please use English :)
11 | - For questions, ask in [Discussions](https://github.com/asoul-sig/asouldocs/discussions).
12 | - Before you file an issue read the [Contributing guide](https://github.com/asoul-sig/asouldocs/blob/main/.github/contributing.md).
13 | - Check to make sure someone hasn't already opened a similar [issue](https://github.com/asoul-sig/asouldocs/issues).
14 | - type: textarea
15 | attributes:
16 | label: What needs to be improved? Please describe
17 | description: A clear and concise description of what is wrong or missing.
18 | validations:
19 | required: true
20 | - type: textarea
21 | attributes:
22 | label: Why do you think it is important?
23 | description: A clear and concise explanation of the rationale.
24 | validations:
25 | required: true
26 | - type: checkboxes
27 | attributes:
28 | label: Code of Conduct
29 | description: By submitting this issue, you agree to follow our [Code of Conduct](https://go.dev/conduct)
30 | options:
31 | - label: I agree to follow this project's Code of Conduct
32 | required: true
33 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.yml:
--------------------------------------------------------------------------------
1 | name: Feature request
2 | description: Suggest an idea for this project
3 | labels: ["\U0001F3AF feature"]
4 | body:
5 | - type: markdown
6 | attributes:
7 | value: |
8 | Thanks for taking the time to fill out this form!
9 |
10 | - Please use English :)
11 | - For questions, ask in [Discussions](https://github.com/asoul-sig/asouldocs/discussions).
12 | - Before you file an issue read the [Contributing guide](https://github.com/asoul-sig/asouldocs/blob/main/.github/contributing.md).
13 | - Check to make sure someone hasn't already opened a similar [issue](https://github.com/asoul-sig/asouldocs/issues).
14 | - type: textarea
15 | attributes:
16 | label: Describe the feature
17 | description: A clear and concise description of what the feature is, e.g. I think it is reasonable to have [...]
18 | validations:
19 | required: true
20 | - type: textarea
21 | attributes:
22 | label: Describe the solution you'd like
23 | description: A clear and concise description of what you want to happen.
24 | validations:
25 | required: true
26 | - type: textarea
27 | attributes:
28 | label: Describe alternatives you've considered
29 | description: A clear and concise description of any alternative solutions or features you've considered.
30 | validations:
31 | required: true
32 | - type: textarea
33 | attributes:
34 | label: Additional context
35 | description: |
36 | Links? References? Suggestions? Anything that will give us more context about the feature you are requesting!
37 |
38 | Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
39 | validations:
40 | required: false
41 | - type: checkboxes
42 | attributes:
43 | label: Code of Conduct
44 | description: By submitting this issue, you agree to follow our [Code of Conduct](https://go.dev/conduct)
45 | options:
46 | - label: I agree to follow this project's Code of Conduct
47 | required: true
48 |
--------------------------------------------------------------------------------
/.github/contributing.md:
--------------------------------------------------------------------------------
1 | # Welcome to _**ASoulDocs**_ contributing guide
2 |
3 | Thank you for investing your time in contributing to our projects!
4 |
5 | Read our [Code of Conduct](https://go.dev/conduct) to keep our community approachable and respectable.
6 |
7 | In this guide you will get an overview of the contribution workflow from opening an issue, creating a PR, reviewing, and merging the PR.
8 |
9 | Use the table of contents icon on the top left corner of this document to get to a specific section of this guide quickly.
10 |
11 | ## New contributor guide
12 |
13 | To get an overview of the project, read the [README](/README.md). Here are some resources to help you get started with open source contributions:
14 |
15 | - [Finding ways to contribute to open source on GitHub](https://docs.github.com/en/get-started/exploring-projects-on-github/finding-ways-to-contribute-to-open-source-on-github)
16 | - [Set up Git](https://docs.github.com/en/get-started/quickstart/set-up-git)
17 | - [GitHub flow](https://docs.github.com/en/get-started/quickstart/github-flow)
18 | - [Collaborating with pull requests](https://docs.github.com/en/github/collaborating-with-pull-requests)
19 |
20 | In addition to the general guides with open source contributions, you would also need to:
21 |
22 | - Have basic knowledge about HTTP, web applications development and programming in [Go](https://go.dev/).
23 | - Have a working local development setup with a reasonable good IDE or editor like [Visual Studio Code](https://code.visualstudio.com/docs/languages/go), [GoLand](https://www.jetbrains.com/go/) or [Vim](https://github.com/fatih/vim-go).
24 |
25 | ## Philosophy and methodology
26 |
27 | - [Talk, then code](https://www.craft.do/s/kyHVs6OoE4Dj5V)
28 |
29 | ## Issues
30 |
31 | ### Create a new issue
32 |
33 | - For questions, ask in [Discussions](https://github.com/asoul-sig/asouldocs/discussions).
34 | - [Check to make sure](https://docs.github.com/en/github/searching-for-information-on-github/searching-on-github/searching-issues-and-pull-requests#search-by-the-title-body-or-comments) someone hasn't already opened a similar [issue](https://github.com/asoul-sig/asouldocs/issues).
35 | - If a similar issue doesn't exist, open a new issue using a relevant [issue form](https://github.com/asoul-sig/asouldocs/issues/new/choose).
36 |
37 | ### Pick up an issue to solve
38 |
39 | - Scan through our [existing issues](https://github.com/asoul-sig/asouldocs/issues) to find one that interests you.
40 | - The [👋 good first issue](https://github.com/asoul-sig/asouldocs/issues?q=is%3Aissue+is%3Aopen+label%3A%22%F0%9F%91%8B+good+first+issue%22) is a good place to start exploring issues that are well-groomed for newcomers.
41 | - Do not hesitate to ask for more details or clarifying questions on the issue!
42 | - Communicate on the issue you are intended to pick up _before_ starting working on it.
43 | - Every issue that gets picked up will have an expected timeline for the implementation, the issue may be reassigned after the expected timeline. Please be responsible and proactive on the communication 🙇♂️
44 |
45 | ## Pull requests
46 |
47 | When you're finished with the changes, create a pull request, or a series of pull requests if necessary.
48 |
49 | Contributing to another codebase is not as simple as code changes, it is also about contributing influence to the design. Therefore, we kindly ask you that:
50 |
51 | - Please acknowledge that no pull request is guaranteed to be merged.
52 | - Please always do a self-review before requesting reviews from others.
53 | - Please expect code review to be strict and may have multiple rounds.
54 | - Please make self-contained incremental changes, pull requests with huge diff may be rejected for review.
55 | - Please use English in code comments and docstring.
56 | - Please do not force push unless absolutely necessary. Force pushes make review much harder in multiple rounds, and we use [Squash and merge](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/about-pull-request-merges#squash-and-merge-your-pull-request-commits) so you don't need to worry about messy commits and just focus on the changes.
57 |
58 | ## Your PR is merged!
59 |
60 | Congratulations 🎉🎉 Thanks again for taking the effort to have this journey with us 🌟
61 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | # Docs: https://git.io/JCUAY
2 | version: 2
3 | updates:
4 | - package-ecosystem: "gomod"
5 | directory: "/"
6 | schedule:
7 | interval: "monthly"
8 | commit-message:
9 | prefix: "mod:"
10 | - package-ecosystem: "github-actions"
11 | directory: "/"
12 | schedule:
13 | interval: "monthly"
14 |
--------------------------------------------------------------------------------
/.github/pull_request_template.md:
--------------------------------------------------------------------------------
1 | ### Describe the pull request
2 |
3 | A clear and concise description of what the pull request is about, i.e. what problem should be fixed?
4 |
5 | Link to the issue:
6 |
7 | ### Checklist
8 |
9 | - [ ] I agree to follow the [Code of Conduct](https://go.dev/conduct) by submitting this pull request.
10 | - [ ] I have read and acknowledge the [Contributing guide](https://github.com/asoul-sig/asouldocs/blob/main/.github/contributing.md).
11 | - [ ] I have added test cases to cover the new code.
12 |
--------------------------------------------------------------------------------
/.github/workflows/codeql.yml:
--------------------------------------------------------------------------------
1 | # For most projects, this workflow file will not need changing; you simply need
2 | # to commit it to your repository.
3 | #
4 | # You may wish to alter this file to override the set of languages analyzed,
5 | # or to provide custom queries or build logic.
6 | #
7 | # ******** NOTE ********
8 | # We have attempted to detect the languages in your repository. Please check
9 | # the `language` matrix defined below to confirm you have the correct set of
10 | # supported CodeQL languages.
11 | #
12 | name: "CodeQL"
13 |
14 | on:
15 | push:
16 | branches: [ main ]
17 | pull_request:
18 | paths:
19 | - '.github/workflows/codeql.yml'
20 | schedule:
21 | - cron: '0 19 * * 0'
22 |
23 | jobs:
24 | analyze:
25 | name: Analyze
26 | runs-on: ubuntu-latest
27 |
28 | strategy:
29 | fail-fast: false
30 | matrix:
31 | language: [ 'go' ]
32 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
33 | # Learn more:
34 | # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
35 |
36 | steps:
37 | - name: Checkout repository
38 | uses: actions/checkout@v4
39 | with:
40 | # We must fetch at least the immediate parents so that if this is
41 | # a pull request then we can checkout the head.
42 | fetch-depth: 2
43 |
44 | # If this run was triggered by a pull request event, then checkout
45 | # the head of the pull request instead of the merge commit.
46 | - run: git checkout HEAD^2
47 | if: ${{ github.event_name == 'pull_request' }}
48 |
49 | # Initializes the CodeQL tools for scanning.
50 | - name: Initialize CodeQL
51 | uses: github/codeql-action/init@v3
52 | with:
53 | languages: ${{ matrix.language }}
54 | # If you wish to specify custom queries, you can do so here or in a config file.
55 | # By default, queries listed here will override any specified in a config file.
56 | # Prefix the list here with "+" to use these queries and those in the config file.
57 | # queries: ./path/to/local/query, your-org/your-repo/queries@main
58 |
59 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
60 | # If this step fails, then you should remove it and run the build manually (see below)
61 | - name: Autobuild
62 | uses: github/codeql-action/autobuild@v3
63 |
64 | # ℹ️ Command-line programs to run using the OS shell.
65 | # 📚 https://git.io/JvXDl
66 |
67 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
68 | # and modify them (or add more) to build your code if your project
69 | # uses a compiled language
70 |
71 | #- run: |
72 | # make bootstrap
73 | # make release
74 |
75 | - name: Perform CodeQL Analysis
76 | uses: github/codeql-action/analyze@v3
77 |
--------------------------------------------------------------------------------
/.github/workflows/docker.yml:
--------------------------------------------------------------------------------
1 | name: Docker
2 | on:
3 | push:
4 | branches:
5 | - main
6 | pull_request:
7 | paths:
8 | - 'Dockerfile'
9 | - '.github/workflows/docker.yml'
10 | release:
11 | types: [ published ]
12 |
13 | jobs:
14 | buildx:
15 | if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
16 | runs-on: ubuntu-latest
17 | permissions:
18 | actions: write
19 | contents: read
20 | packages: write
21 | steps:
22 | - name: Canel previous runs
23 | uses: styfle/cancel-workflow-action@0.12.1
24 | with:
25 | all_but_latest: true
26 | access_token: ${{ secrets.GITHUB_TOKEN }}
27 | - name: Checkout code
28 | uses: actions/checkout@v4
29 | - name: Set up QEMU
30 | uses: docker/setup-qemu-action@v3
31 | - name: Set up Docker Buildx
32 | id: buildx
33 | uses: docker/setup-buildx-action@v3
34 | with:
35 | config-inline: |
36 | [worker.oci]
37 | max-parallelism = 2
38 | - name: Inspect builder
39 | run: |
40 | echo "Name: ${{ steps.buildx.outputs.name }}"
41 | echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
42 | echo "Status: ${{ steps.buildx.outputs.status }}"
43 | echo "Flags: ${{ steps.buildx.outputs.flags }}"
44 | echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
45 | - name: Login to Docker Hub
46 | uses: docker/login-action@v3
47 | with:
48 | username: ${{ secrets.DOCKERHUB_USERNAME }}
49 | password: ${{ secrets.DOCKERHUB_TOKEN }}
50 | - name: Login to GitHub Container registry
51 | uses: docker/login-action@v3
52 | with:
53 | registry: ghcr.io
54 | username: ${{ github.repository_owner }}
55 | password: ${{ secrets.GITHUB_TOKEN }}
56 | - name: Build and push images
57 | uses: docker/build-push-action@v6
58 | with:
59 | context: .
60 | platforms: linux/amd64,linux/arm64,linux/arm/v7
61 | push: true
62 | tags: |
63 | unknwon/asouldocs:latest
64 | ghcr.io/asoul-sig/asouldocs:latest
65 | - name: Send email on failure
66 | uses: dawidd6/action-send-mail@v5
67 | if: ${{ failure() }}
68 | with:
69 | server_address: smtp.mailgun.org
70 | server_port: 465
71 | username: ${{ secrets.SMTP_USERNAME }}
72 | password: ${{ secrets.SMTP_PASSWORD }}
73 | subject: GitHub Actions (${{ github.repository }}) job result
74 | to: github-actions-8ce6454@unknwon.io
75 | from: GitHub Actions (${{ github.repository }})
76 | reply_to: noreply@unknwon.io
77 | body: |
78 | The job "${{ github.job }}" of ${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }} completed with "${{ job.status }}".
79 |
80 | View the job run at: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
81 |
82 | buildx-pull-request:
83 | if: ${{ github.event_name == 'pull_request'}}
84 | runs-on: ubuntu-latest
85 | permissions:
86 | contents: read
87 | steps:
88 | - name: Checkout code
89 | uses: actions/checkout@v4
90 | - name: Set up Docker Buildx
91 | id: buildx
92 | uses: docker/setup-buildx-action@v3
93 | with:
94 | config-inline: |
95 | [worker.oci]
96 | max-parallelism = 2
97 | - name: Inspect builder
98 | run: |
99 | echo "Name: ${{ steps.buildx.outputs.name }}"
100 | echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
101 | echo "Status: ${{ steps.buildx.outputs.status }}"
102 | echo "Flags: ${{ steps.buildx.outputs.flags }}"
103 | echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
104 | - name: Compute short commit SHA
105 | uses: benjlevesque/short-sha@v3.0
106 | - name: Build and push images
107 | uses: docker/build-push-action@v6
108 | with:
109 | context: .
110 | platforms: linux/amd64
111 | push: true
112 | tags: |
113 | ttl.sh/asoul-sig/asouldocs-${{ env.SHA }}:1d
114 |
115 | # Updates to the following section needs to be synced to all release branches within their lifecycles.
116 | buildx-release:
117 | if: ${{ github.event_name == 'release' }}
118 | runs-on: ubuntu-latest
119 | permissions:
120 | actions: write
121 | contents: read
122 | packages: write
123 | steps:
124 | - name: Compute image tag name
125 | run: echo "IMAGE_TAG=$(echo $GITHUB_REF_NAME | cut -c 2-)" >> $GITHUB_ENV
126 | - name: Checkout code
127 | uses: actions/checkout@v4
128 | - name: Set up QEMU
129 | uses: docker/setup-qemu-action@v3
130 | - name: Set up Docker Buildx
131 | id: buildx
132 | uses: docker/setup-buildx-action@v3
133 | with:
134 | config-inline: |
135 | [worker.oci]
136 | max-parallelism = 2
137 | - name: Inspect builder
138 | run: |
139 | echo "Name: ${{ steps.buildx.outputs.name }}"
140 | echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
141 | echo "Status: ${{ steps.buildx.outputs.status }}"
142 | echo "Flags: ${{ steps.buildx.outputs.flags }}"
143 | echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
144 | - name: Login to Docker Hub
145 | uses: docker/login-action@v3
146 | with:
147 | username: ${{ secrets.DOCKERHUB_USERNAME }}
148 | password: ${{ secrets.DOCKERHUB_TOKEN }}
149 | - name: Login to GitHub Container registry
150 | uses: docker/login-action@v3
151 | with:
152 | registry: ghcr.io
153 | username: ${{ github.repository_owner }}
154 | password: ${{ secrets.GITHUB_TOKEN }}
155 | - name: Build and push images
156 | uses: docker/build-push-action@v6
157 | with:
158 | context: .
159 | platforms: linux/amd64,linux/arm64,linux/arm/v7
160 | push: true
161 | tags: |
162 | unknwon/asouldocs:${{ env.IMAGE_TAG }}
163 | ghcr.io/asoul-sig/asouldocs:${{ env.IMAGE_TAG }}
164 | - name: Send email on failure
165 | uses: dawidd6/action-send-mail@v5
166 | if: ${{ failure() }}
167 | with:
168 | server_address: smtp.mailgun.org
169 | server_port: 465
170 | username: ${{ secrets.SMTP_USERNAME }}
171 | password: ${{ secrets.SMTP_PASSWORD }}
172 | subject: GitHub Actions (${{ github.repository }}) job result
173 | to: github-actions-8ce6454@unknwon.io
174 | from: GitHub Actions (${{ github.repository }})
175 | reply_to: noreply@unknwon.io
176 | body: |
177 | The job "${{ github.job }}" of ${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }} completed with "${{ job.status }}".
178 |
179 | View the job run at: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
180 |
--------------------------------------------------------------------------------
/.github/workflows/go.yml:
--------------------------------------------------------------------------------
1 | name: Go
2 | on:
3 | push:
4 | branches: [ main ]
5 | paths:
6 | - '**.go'
7 | - 'go.mod'
8 | - '.golangci.yml'
9 | - '.github/workflows/go.yml'
10 | pull_request:
11 | paths:
12 | - '**.go'
13 | - 'go.mod'
14 | - '.golangci.yml'
15 | - '.github/workflows/go.yml'
16 | env:
17 | GOPROXY: "https://proxy.golang.org"
18 |
19 | jobs:
20 | lint:
21 | name: Lint
22 | runs-on: ubuntu-latest
23 | steps:
24 | - name: Checkout code
25 | uses: actions/checkout@v4
26 | - name: Run golangci-lint
27 | uses: golangci/golangci-lint-action@v8
28 | with:
29 | version: latest
30 | args: --timeout=30m
31 | - name: Check Go module tidiness
32 | shell: bash
33 | run: |
34 | go mod tidy
35 | STATUS=$(git status --porcelain go.mod go.sum)
36 | if [ ! -z "$STATUS" ]; then
37 | echo "Running go mod tidy modified go.mod and/or go.sum"
38 | exit 1
39 | fi
40 |
41 | test:
42 | name: Test
43 | strategy:
44 | matrix:
45 | go-version: [ 1.21.x, 1.22.x ]
46 | platform: [ ubuntu-latest, macos-latest, windows-latest ]
47 | runs-on: ${{ matrix.platform }}
48 | steps:
49 | - name: Install Go
50 | uses: actions/setup-go@v5
51 | with:
52 | go-version: ${{ matrix.go-version }}
53 | - name: Checkout code
54 | uses: actions/checkout@v4
55 | - name: Run tests
56 | run: go test -v -race ./...
57 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Object files, Static and Dynamic libs (Shared Objects)
2 | *.o
3 | *.a
4 | *.so
5 |
6 | # Folders
7 | _obj
8 | _test
9 |
10 | # Architecture specific extensions/prefixes
11 | *.[568vq]
12 | [568vq].out
13 |
14 | *.cgo1.go
15 | *.cgo2.c
16 | _cgo_defun.c
17 | _cgo_gotypes.go
18 | _cgo_export.*
19 |
20 | _testmain.go
21 |
22 | *.exe
23 | *.test
24 | *.prof
25 | custom/
26 | data
27 | /.idea
28 | /asouldocs
29 | .DS_Store
30 | .task
31 | node_modules
32 |
--------------------------------------------------------------------------------
/.golangci.yml:
--------------------------------------------------------------------------------
1 | version: "2"
2 | linters:
3 | enable:
4 | - nakedret
5 | - rowserrcheck
6 | - unconvert
7 | - unparam
8 | settings:
9 | nakedret:
10 | max-func-lines: 0 # Disallow any unnamed return statement
11 | exclusions:
12 | generated: lax
13 | presets:
14 | - comments
15 | - common-false-positives
16 | - legacy
17 | - std-error-handling
18 | paths:
19 | - third_party$
20 | - builtin$
21 | - examples$
22 | formatters:
23 | enable:
24 | - gofmt
25 | - goimports
26 | exclusions:
27 | generated: lax
28 | paths:
29 | - third_party$
30 | - builtin$
31 | - examples$
32 |
--------------------------------------------------------------------------------
/CODEOWNERS:
--------------------------------------------------------------------------------
1 | # Default
2 | * @asoul-sig/core
3 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM golang:alpine3.15 AS binarybuilder
2 | RUN apk --no-cache --no-progress add --virtual \
3 | build-deps \
4 | build-base \
5 | git
6 |
7 | # Install Task
8 | RUN wget --quiet https://github.com/go-task/task/releases/download/v3.12.0/task_linux_amd64.tar.gz -O task_linux_amd64.tar.gz \
9 | && sh -c 'echo "803d3c1752da31486cbfb4ddf7d8ba5e0fa8c8ebba8acf227a9cd76ff9901343 task_linux_amd64.tar.gz" | sha256sum -c' \
10 | && tar -xzf task_linux_amd64.tar.gz \
11 | && mv task /usr/local/bin/task
12 |
13 | WORKDIR /dist
14 | COPY . .
15 | RUN task build
16 |
17 | FROM alpine:3.15
18 | RUN echo https://dl-cdn.alpinelinux.org/alpine/edge/community/ >> /etc/apk/repositories \
19 | && apk --no-cache --no-progress add \
20 | ca-certificates \
21 | git
22 |
23 | # Install gosu
24 | RUN export url="https://github.com/tianon/gosu/releases/download/1.14/gosu-"; \
25 | if [ `uname -m` == "aarch64" ]; then \
26 | wget --quiet ${url}arm64 -O /usr/sbin/gosu \
27 | && sh -c 'echo "73244a858f5514a927a0f2510d533b4b57169b64d2aa3f9d98d92a7a7df80cea /usr/sbin/gosu" | sha256sum -c'; \
28 | elif [ `uname -m` == "armv7l" ]; then \
29 | wget --quiet ${url}armhf -O /usr/sbin/gosu \
30 | && sh -c 'echo "abb1489357358b443789571d52b5410258ddaca525ee7ac3ba0dd91d34484589 /usr/sbin/gosu" | sha256sum -c'; \
31 | else \
32 | wget --quiet ${url}amd64 -O /usr/sbin/gosu \
33 | && sh -c 'echo "bd8be776e97ec2b911190a82d9ab3fa6c013ae6d3121eea3d0bfd5c82a0eaf8c /usr/sbin/gosu" | sha256sum -c'; \
34 | fi \
35 | && chmod +x /usr/sbin/gosu
36 |
37 | WORKDIR /app/asouldocs/
38 | COPY --from=binarybuilder /dist/asouldocs .
39 |
40 | VOLUME ["/app/asouldocs/custom"]
41 | EXPOSE 5555
42 | CMD ["/app/asouldocs/asouldocs", "web"]
43 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2015 ASoulDocs
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 
2 | 
3 |
4 |
5 |
6 |
7 | _**ASoulDocs**_ is a stupid web server for multilingual documentation.
8 |
9 |
10 | ## Features
11 |
12 | - Multilingual documentation with [language fallback](https://asouldocs.dev/docs/howto/set-up-documentation#Localization%20configuration)
13 | - Builtin [push-to-sync through webhook](https://asouldocs.dev/docs/howto/sync-through-webhook)
14 | - Integrated [commenting systems and analytics platforms](https://asouldocs.dev/docs/howto/use-extensions)
15 | - Automatic dark mode
16 | - Fully [customizable look and feel](https://asouldocs.dev/docs/howto/customize-templates)
17 |
18 | ## Getting help
19 |
20 | - Please [file an issue](https://github.com/asoul-sig/asouldocs/issues) or [start a discussion](https://github.com/asoul-sig/asouldocs/discussions) if you want to reach out.
21 |
22 | ## License
23 |
24 | This project is under the MIT License. See the [LICENSE](LICENSE) file for the full license text.
25 |
--------------------------------------------------------------------------------
/Taskfile.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 |
3 | vars:
4 | PKG_PATH: github.com/asoul-sig/asouldocs/internal/conf
5 | BUILD_TIME:
6 | sh: date -u '+%Y-%m-%d %I:%M:%S %Z'
7 | BUILD_COMMIT:
8 | sh: git rev-parse HEAD
9 |
10 | tasks:
11 | web:
12 | desc: Build the binary and start the web server
13 | deps: [build]
14 | cmds:
15 | - ./asouldocs web
16 |
17 | build:
18 | desc: Build the binary
19 | cmds:
20 | - go build -v
21 | -ldflags '
22 | -X "{{.PKG_PATH}}.BuildTime={{.BUILD_TIME}}"
23 | -X "{{.PKG_PATH}}.BuildCommit={{.BUILD_COMMIT}}"'
24 | -trimpath -o asouldocs
25 | sources:
26 | - main.go
27 | - internal/**/*.go
28 | - conf/**/*
29 | - public/embed.go
30 | - templates/embed.go
31 | - docs/toc.ini
32 | method: timestamp
33 |
34 | clean:
35 | desc: Cleans up system meta files
36 | cmds:
37 | - find . -name "*.DS_Store" -type f -delete
38 | - rm asouldocs_* checksum_sha256.txt
39 |
40 | release:
41 | desc: Build the binaries and pack resources to ZIP archives
42 | cmds:
43 | - env GOOS=darwin GOARCH=amd64 go build -ldflags '-X "{{.PKG_PATH}}.BuildTime={{.BUILD_TIME}}" -X "{{.PKG_PATH}}.BuildCommit={{.BUILD_COMMIT}}" -X "{{.PKG_PATH}}.BuildVersion={{.BUILD_VERSION}}"' -trimpath -o asouldocs; tar czf asouldocs_{{.BUILD_VERSION}}_darwin_amd64.tar.gz asouldocs
44 | - env GOOS=darwin GOARCH=arm64 go build -ldflags '-X "{{.PKG_PATH}}.BuildTime={{.BUILD_TIME}}" -X "{{.PKG_PATH}}.BuildCommit={{.BUILD_COMMIT}}" -X "{{.PKG_PATH}}.BuildVersion={{.BUILD_VERSION}}"' -trimpath -o asouldocs; tar czf asouldocs_{{.BUILD_VERSION}}_darwin_arm64.tar.gz asouldocs
45 | - env GOOS=linux GOARCH=amd64 go build -ldflags '-X "{{.PKG_PATH}}.BuildTime={{.BUILD_TIME}}" -X "{{.PKG_PATH}}.BuildCommit={{.BUILD_COMMIT}}" -X "{{.PKG_PATH}}.BuildVersion={{.BUILD_VERSION}}"' -trimpath -o asouldocs; tar czf asouldocs_{{.BUILD_VERSION}}_linux_amd64.tar.gz asouldocs
46 | - env GOOS=linux GOARCH=386 go build -ldflags '-X "{{.PKG_PATH}}.BuildTime={{.BUILD_TIME}}" -X "{{.PKG_PATH}}.BuildCommit={{.BUILD_COMMIT}}" -X "{{.PKG_PATH}}.BuildVersion={{.BUILD_VERSION}}"' -trimpath -o asouldocs; tar czf asouldocs_{{.BUILD_VERSION}}_linux_386.tar.gz asouldocs
47 | - env GOOS=linux GOARCH=arm go build -ldflags '-X "{{.PKG_PATH}}.BuildTime={{.BUILD_TIME}}" -X "{{.PKG_PATH}}.BuildCommit={{.BUILD_COMMIT}}" -X "{{.PKG_PATH}}.BuildVersion={{.BUILD_VERSION}}"' -trimpath -o asouldocs; tar czf asouldocs_{{.BUILD_VERSION}}_linux_arm.tar.gz asouldocs
48 | - env GOOS=windows GOARCH=amd64 go build -ldflags '-X "{{.PKG_PATH}}.BuildTime={{.BUILD_TIME}}" -X "{{.PKG_PATH}}.BuildCommit={{.BUILD_COMMIT}}" -X "{{.PKG_PATH}}.BuildVersion={{.BUILD_VERSION}}"' -trimpath -o asouldocs.exe; tar czf asouldocs_{{.BUILD_VERSION}}_windows_amd64.tar.gz asouldocs
49 | - env GOOS=windows GOARCH=386 go build -ldflags '-X "{{.PKG_PATH}}.BuildTime={{.BUILD_TIME}}" -X "{{.PKG_PATH}}.BuildCommit={{.BUILD_COMMIT}}" -X "{{.PKG_PATH}}.BuildVersion={{.BUILD_VERSION}}"' -trimpath -o asouldocs.exe; tar czf asouldocs_{{.BUILD_VERSION}}_windows_386.tar.gz asouldocs
50 | - shasum -a 256 asouldocs_* >> checksum_sha256.txt
51 |
--------------------------------------------------------------------------------
/conf/app.ini:
--------------------------------------------------------------------------------
1 | ; The running environment, could be "dev" or "prod"
2 | ENV = dev
3 | ; The local address to listen on, use "0.0.0.0" to listen on all network interfaces
4 | HTTP_ADDR = localhost
5 | ; The local port to listen on
6 | HTTP_PORT = 5555
7 |
8 | [site]
9 | ; The description of the site
10 | DESCRIPTION = ASoulDocs is a stupid web server for multilingual documentation.
11 | ; The external-facing URL of the site
12 | EXTERNAL_URL = http://localhost:5555
13 |
14 | [asset]
15 | ; The local directory that contains custom assets (e.g. images, CSS, JavaScript)
16 | CUSTOM_DIRECTORY = custom/public
17 |
18 | [page]
19 | ; Whether the site has a landing page, set to "false" to redirect users for documentation directly
20 | HAS_LANDING_PAGE = true
21 | ; The base path for documentation
22 | DOCS_BASE_PATH = /docs
23 | ; The local directory that contains custom templates
24 | CUSTOM_DIRECTORY = custom/templates
25 |
26 | [i18n]
27 | ; The list of languages that is supported
28 | LANGUAGES = en-US,zh-CN
29 | ; The list of user-friendly names of languages
30 | NAMES = English,简体中文
31 | ; The local directory that contains custom locale files
32 | CUSTOM_DIRECTORY = custom/locale
33 |
34 | [docs]
35 | ; The type of the documentation, could be "local" or "remote"
36 | TYPE = local
37 | ; The local path or remote Git address
38 | TARGET = ./docs
39 | ; The relative directory where the root of documentation resides within the target
40 | TARGET_DIR =
41 | ; The format to construct a edit page link, leave it empty to disable, e.g.
42 | ; https://github.com/asoul-sig/asouldocs/blob/main/docs/{blob}
43 | EDIT_PAGE_LINK_FORMAT =
44 |
45 | ; https://plausible.io/
46 | [extension.plausible]
47 | ; Whether to enable this extension
48 | ENABLED = false
49 | ; The optional value to be specified for the "data-domain" attribute
50 | DOMAIN =
51 |
52 | ; https://developers.google.com/analytics/devguides/collection/ga4
53 | [extension.google_analytics]
54 | ; Whether to enable this extension
55 | ENABLED = false
56 | ; The measurement ID of your property
57 | MEASUREMENT_ID =
58 |
59 | ; https://disqus.com/
60 | [extension.disqus]
61 | ; Whether to enable this extension
62 | ENABLED = false
63 | ; The shortname of your site
64 | SHORTNAME =
65 |
66 | ; https://utteranc.es/
67 | [extension.utterances]
68 | ; Whether to enable this extension
69 | ENABLED = false
70 | ; The GitHub repository
71 | REPO =
72 | ; The issue mapping pattern
73 | ISSUE_TERM = pathname
74 | ; The issue label for comments
75 | LABEL = utterances
76 | ; The theme of the component
77 | THEME = github-light
78 |
--------------------------------------------------------------------------------
/conf/embed.go:
--------------------------------------------------------------------------------
1 | // Copyright 2022 ASoulDocs. All rights reserved.
2 | // Use of this source code is governed by a MIT-style
3 | // license that can be found in the LICENSE file.
4 |
5 | package conf
6 |
7 | import (
8 | "embed"
9 | )
10 |
11 | //go:embed app.ini
12 | var Files embed.FS
13 |
--------------------------------------------------------------------------------
/conf/locale/embed.go:
--------------------------------------------------------------------------------
1 | // Copyright 2022 ASoulDocs. All rights reserved.
2 | // Use of this source code is governed by a MIT-style
3 | // license that can be found in the LICENSE file.
4 |
5 | package locale
6 |
7 | import (
8 | "embed"
9 | )
10 |
11 | //go:embed *.ini
12 | var Files embed.FS
13 |
--------------------------------------------------------------------------------
/conf/locale/locale_en-US.ini:
--------------------------------------------------------------------------------
1 | name = ASoulDocs
2 | tag_line = A stupid web server for multilingual documentation
3 |
4 | [navbar]
5 | docs = Docs
6 |
7 | [home]
8 | title = ASoulDocs
9 | tag_line = A stupid web server for multilingual documentation.
10 | get_started = Get started
11 |
12 | multilingual = Multilingual
13 | multilingual_desc = Give your users the best documentation experience ever with the ability to instantly change between multiple languages, and remember their preference!
14 | real_time_sync = Real-time synchronization
15 | real_time_sync_desc = Stop wasting time on worthless waiting! Keep in sync of your documentation in real-time from any Git hosting sources.
16 | searchable = Full-text search
17 | searchable_desc = The best way to navigate users through your documentation is being able to search, seamlessly integrated with Algolia.
18 | markdown = Markdown
19 | markdown_desc = Markdown is getting its dominance as the language of documentation for 2022.
20 | customizable = Customizable
21 | customizable_desc = It is your ultimate right to present the site to your users that is unique to your project.
22 | comment = Commenting
23 | comment_desc = Integrate with popular commenting systems like Disqus and utterances. Let users give you feedback directly without a hitch.
24 |
25 | [docs]
26 | pages = Pages
27 | showing_default = The document you're looking for is not available in current language, and we're showing the version of default language to you.
28 | on_this_page = On this page
29 | edit_this_page = Edit this page
30 |
31 | [status]
32 | 404 = Page Not Found
33 | 404_desc = Something unexpected happened, but who cares I'm 404.
34 |
35 | [footer]
36 | getting_started = Getting started
37 | installation = Installation
38 | documentation = Documentation
39 | extensions = Extensions
40 |
41 | powered_by = Powered by
42 | languages = Languages
43 | copyright = A-SOUL SIG. All rights reserved.
44 |
45 | [alert]
46 | warning = Attention needed
47 |
--------------------------------------------------------------------------------
/conf/locale/locale_zh-CN.ini:
--------------------------------------------------------------------------------
1 | name = 一魂文档
2 | tag_line = 一款支持多语言的 Web 文档服务器
3 |
4 | [navbar]
5 | docs = 查看文档
6 |
7 | [home]
8 | title = 一魂文档
9 | tag_line = 一款支持多语言的 Web 文档服务器
10 | get_started = 开始使用
11 |
12 | multilingual = 多语言支持
13 | multilingual_desc = 可即时切换多语言来为您的用户提供最佳的文档浏览体验,并可在下次访问时自动展示保存的语言偏好
14 | real_time_sync = 实时更新同步
15 | real_time_sync_desc = 告别无谓的等待,从任意的 Git 托管源实时同步您的文档,一年可以省下好多烟钱!
16 | searchable = 支持全文搜索
17 | searchable_desc = 内置集成文档搜索引擎 Algolia,为您的用户提供世界一流的查询体验,快速定位感兴趣的内容
18 | markdown = Markdown 语法
19 | markdown_desc = Markdown 语法凭借着自身简单易懂的特性,广受社区好评,并已然成为编写文档的首选语言
20 | customizable = 高度可定制
21 | customizable_desc = 可高度自定义化的架构设计,除了核心渲染模块全部可以换掉,为每一个产品展现不一样的自己
22 | comment = 评论系统集成
23 | comment_desc = 内置集成 Disqus 和 utterances 评论系统,让产品与用户零距离,收集反馈不再困难
24 |
25 | [docs]
26 | pages = 页面
27 | showing_default = 您所查看的文档没有与当前语言匹配的版本,因此我们将显示默认语言的版本。
28 | on_this_page = 页内导航
29 | edit_this_page = 编辑本页内容
30 |
31 | [status]
32 | 404 = 页面未找到
33 | 404_desc = 没想到我藏得这么深都能被你发现,然而并没有什么卵用。
34 |
35 | [footer]
36 | getting_started = 开始使用
37 | installation = 下载安装
38 | documentation = 创建文档
39 | extensions = 使用扩展
40 |
41 | powered_by = 网站基于
42 | languages = 语言选项
43 | copyright = A-SOUL 特别兴趣小组 - 版权所有
44 |
45 | [alert]
46 | warning = 温馨提示
47 |
--------------------------------------------------------------------------------
/docs/assets/github-webhook.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asoul-sig/asouldocs/031839cf765ec8e8de2c0cf5e5b10af96cb9b4c3/docs/assets/github-webhook.jpg
--------------------------------------------------------------------------------
/docs/dev/local_development.md:
--------------------------------------------------------------------------------
1 | # Set up your development environment
2 |
3 | _**ASoulDocs**_ is written in [Go](https://golang.org/), please take [A Tour of Go](https://tour.golang.org/) if you haven't done so!
4 |
5 | ## Outline
6 |
7 | - [Environment](#environment)
8 | - [Step 1: Install dependencies](#step-1-install-dependencies)
9 | - [Step 2: Get the code](#step-2-get-the-code)
10 | - [Step 3: Start the server](#step-3-start-the-server)
11 | - [Other nice things](#other-nice-things)
12 |
13 | ## Environment
14 |
15 | _**ASoulDocs**_ is built and runs as a single binary and meant to be cross platform. Therefore, you should be able to develop _**ASoulDocs**_ in any major platforms you prefer. However, this guide will focus on macOS only.
16 |
17 | ## Step 1: Install dependencies
18 |
19 | _**ASoulDocs**_ has the following dependencies:
20 |
21 | - [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) (v2 or higher)
22 | - [Go](https://go.dev/doc/install) (v1.17 or higher)
23 | - [Task](https://taskfile.dev/) (v3)
24 |
25 | 1. Install [Homebrew](https://brew.sh/).
26 | 1. Install dependencies:
27 |
28 | ```bash
29 | brew install go git go-task/tap/go-task
30 | ```
31 |
32 | ## Step 2: Get the code
33 |
34 | Generally, you don't need a full clone, so set `--depth` to `10`:
35 |
36 | ```bash
37 | git clone --depth 10 https://github.com/asoul-sig/asouldocs.git
38 |
39 | # or
40 |
41 | git clone --depth 10 git@github.com:asoul-sig/asouldocs.git
42 | ```
43 |
44 | **NOTE** The repository has Go modules enabled, please clone to somewhere outside of your `$GOPATH`.
45 |
46 | ## Step 3: Start the server
47 |
48 | The following command will start the web server and automatically recompile and restart the server if any watched files changed:
49 |
50 | ```bash
51 | task web --watch
52 | ```
53 |
54 | ## Other nice things
55 |
56 | ### Load HTML templates and static files from disk
57 |
58 | When you are actively working on HTML templates and static files during development, you would want to ensure the following configuration to avoid recompiling and restarting _**ASoulDocs**_ every time you make a change to files under `templates/` and `public/` directories:
59 |
60 | ```ini
61 | ENV = dev
62 | ```
63 |
--------------------------------------------------------------------------------
/docs/dev/new_release.md:
--------------------------------------------------------------------------------
1 | # Release a new version
2 |
3 | ## Playbook
4 |
5 | ### Build and pack binaries
6 |
7 | ```bash
8 | $ BUILD_VERSION="1.0.0-beta.1" task release
9 |
10 | # Upload binaries to the GitHub release
11 |
12 | $ task clean # to clean up
13 | ```
14 |
--------------------------------------------------------------------------------
/docs/en-US/howto/README.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: How to ...
3 | ---
4 |
--------------------------------------------------------------------------------
/docs/en-US/howto/configure-reverse-proxy.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Configure reverse proxy
3 | ---
4 |
5 | ## Caddy 2
6 |
7 | You get HTTPS for free and forever just by using [Caddy](https://caddyserver.com/):
8 |
9 | ```caddyfile
10 | {
11 | http_port 80
12 | https_port 443
13 | }
14 |
15 | asouldocs.dev {
16 | reverse_proxy * localhost:5555
17 | }
18 | ```
19 |
20 | ## NGINX
21 |
22 | Here is an example of NGINX config section, but values can be different based on your situation:
23 |
24 | ```nginx
25 | server {
26 | listen 80;
27 | server_name asouldocs.dev;
28 |
29 | location / {
30 | proxy_pass http://localhost:5555;
31 | }
32 | }
33 | ```
34 |
--------------------------------------------------------------------------------
/docs/en-US/howto/customize-templates.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Customize templates
3 | ---
4 |
5 | Every [template file](set-up-documentation.md#template-files) can be customized through overwrite, and custom template files should be placed under the `custom/templates` directory (the path of directory can be changed via `[page] CUSTOM_DIRECTORY`).
6 |
7 | It is only recommended to customize the `home.html` and `common/navbar.html` files to maintain the maximum backward compatibility.
8 |
9 | ## UI framework
10 |
11 | By default, the JIT of [Tailwind CSS](https://tailwindcss.com/) is included so you do not need any build step for using any of its classes in your custom templates.
12 |
13 | However, it is not required to use Tailwind CSS as you have all the freedom to use any UI framework in your `custom/common/head.html` file.
14 |
15 | ## Localization
16 |
17 | The Flamego's [i18n](https://flamego.dev/middleware/i18n.html) middleware is used to handle localization, create locale files under the `custom/locale` directory (the path of directory can be changed via `[i18n] CUSTOM_DIRECTORY`) to customize [localization configuration](set-up-documentation.md#localization-configuration).
18 |
19 | The syntax for invoking localization function in template files looks like `{{call .Tr "footer::copyright"}}`, where `footer` is the section name and `copyright` is the key name.
20 |
21 | ## Static assets
22 |
23 | Custom static assets should be placed under the `custom/public` directory (the path of directory can be changed via `[asset] CUSTOM_DIRECTORY`), then include them in your template file.
24 |
25 | For example, suppose you have a custom static asset in the path `custom/public/css/my.css`, then add the following line in your `custom/common/head.tmpl` file:
26 |
27 | ```go-html-template
28 |
29 | ```
30 |
31 | Notice there is no `public` prefix in the `href` attribute.
32 |
--------------------------------------------------------------------------------
/docs/en-US/howto/run-through-docker.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Run through Docker
3 | ---
4 |
5 | Docker images for the _**ASoulDocs**_ server are available both on [Docker Hub](https://hub.docker.com/r/unknwon/asouldocs) and [GitHub Container Registry](https://github.com/asoul-sig/asouldocs/pkgs/container/asouldocs).
6 |
7 | The `latest` tag represents the latest build from the [`main` branch](https://github.com/asoul-sig/asouldocs).
8 |
9 | ## Caveats
10 |
11 | The `HTTP_ADDR` should be changed to listen on the Docker network or all network addresses:
12 |
13 | ```ini
14 | HTTP_ADDR = 0.0.0.0
15 | ```
16 |
17 | ## Start the container
18 |
19 | You need to volume the `custom` directory into the Docker container for it being able to start (`/app/asouldocs/custom` is the path inside the container):
20 |
21 | ```bash
22 | $ docker run \
23 | --name=asouldocs \
24 | -p 15555:5555 \
25 | -v $(pwd)/custom:/app/asouldocs/custom \
26 | unknwon/asouldocs
27 | ```
28 |
29 | You should also volumn the `docs` directory into the Docker container directly if you are not using a [remote Git address](set-up-documentation.md#target) (`/app/asouldocs/docs` is the path inside the container):
30 |
31 | ```bash
32 | $ docker run \
33 | --name=asouldocs \
34 | -p 15555:5555 \
35 | -v $(pwd)/custom:/app/asouldocs/custom \
36 | -v $(pwd)/docs:/app/asouldocs/docs \
37 | unknwon/asouldocs
38 | ```
39 |
--------------------------------------------------------------------------------
/docs/en-US/howto/set-up-documentation.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Set up documentation
3 | ---
4 |
5 | There are four essential components of a _**ASoulDocs**_ documentation project:
6 |
7 | 1. Configuration file
8 | 1. Template files
9 | 1. Locale files
10 | 1. Actual documents
11 |
12 | ## Configuration file
13 |
14 | The configuration file is required for every documentation project. By default, it is expected be available at `custom/app.ini`.
15 |
16 | Every server comes with a [builtin configuration file](https://github.com/asoul-sig/asouldocs/blob/main/conf/app.ini) as default options. Therefore, you only need to overwrite few options in your own configuration file.
17 |
18 | The `--config` (or `-c`) CLI flag can be used to specify a configuration file that is not located in the default location.
19 |
20 | ## Template files
21 |
22 | Template files are [Go HTML templates](https://pkg.go.dev/html/template) used to render different pages served by the server.
23 |
24 | Every server comes with a set of [builtin template files](https://github.com/asoul-sig/asouldocs/tree/main/templates) that works out-of-the-box. However, the content of builtin template files are probably not what you would want for your documentation in most cases, at least for `home.html` and `common/navbar.html`.
25 |
26 | Luckily, you can overwrite these template files by placing your template files with same file name under the `custom/templates` directory.
27 |
28 | For example, you can replace the "GitHub" in navbar to be a happy face by overwriting the `common/navbar.html`:
29 |
30 | ```go-html-template {hl_lines=["7-10"]}
31 |
44 | ```
45 |
46 | You can read more about how to [customize templates](customize-templates.md).
47 |
48 | ## Document hierarchy
49 |
50 | Whether you want to serve your documentation in multiple languages or just one language, the hierarchy is the same. In the root directory of your documentation, you need a `toc.ini` file and subdirectories using [IETF BCP 47 language tags](https://en.wikipedia.org/wiki/IETF_language_tag), e.g. "en-US", "zh-CN".
51 |
52 | Here is an example hierarchy:
53 |
54 | ```
55 | ├── en-US
56 | │ ├── howto
57 | │ │ ├── README.md
58 | │ │ └── set_up_documentation.md
59 | │ └── introduction
60 | │ ├── README.md
61 | │ ├── installation.md
62 | │ └── quick_start.md
63 | ├── zh-CN
64 | │ ├── howto
65 | │ │ ├── README.md
66 | │ │ └── set_up_documentation.md
67 | │ └── introduction
68 | │ ├── README.md
69 | │ ├── installation.md
70 | │ └── quick_start.md
71 | └── toc.ini
72 | ```
73 |
74 | The `toc.ini` is used to define how exactly these documents should look like on the site (e.g. how they are ordered). The following example is a corresponding `toc.ini` to the above hierarchy:
75 |
76 | ```ini
77 | -: introduction
78 | -: howto
79 |
80 | [introduction]
81 | -: README
82 | -: installation
83 | -: quick_start
84 |
85 | [howto]
86 | -: README
87 | -: set_up_documentation
88 | ```
89 |
90 | In the default section, document directories are defined in the exact order, and these names are corresponding to the directories' title:
91 |
92 | ```ini
93 | -: introduction
94 | -: howto
95 | ```
96 |
97 | Then there are sections for each directory:
98 |
99 | ```ini
100 | [introduction]
101 | ...
102 |
103 | [howto]
104 | ...
105 | ```
106 |
107 | Within each section, files are defined in the exact order, and these names are corresponding to the files' name in the document directory (but without the `.md` extension):
108 |
109 | ```ini
110 | [introduction]
111 | -: README
112 | -: installation
113 | -: quick_start
114 | ```
115 |
116 | Other notes:
117 |
118 | 1. Only single-level directories are supported.
119 | 1. Every document directory must have a `README.md` file, to at least define its name through the [frontmatter](write-document.md#frontmatter).
120 |
121 | ### Localization configuration
122 |
123 | By default, the server assumes to have documentation both in English (`en-US`) and Simplified Chinese (`zh-CN`), as in the [default configuration](https://github.com/asoul-sig/asouldocs/blob/39b59c4159e4a2b0e0a290c79f85c46a3e1faf0b/conf/app.ini#L26-L30):
124 |
125 | ```ini
126 | [i18n]
127 | ; The list of languages that is supported
128 | LANGUAGES = en-US,zh-CN
129 | ; The list of user-friendly names of languages
130 | NAMES = English,简体中文
131 | ```
132 |
133 | The first language in the `LANGUAGES` is considered as the default language, and the server shows its content if the preferred language (from browser's `Accept-Language` request header) does not exists, or the particular document is not available in the preferred language (but available in the default language).
134 |
135 | If you are just writing documentation in English, you would need to overwrite the configuration as follows:
136 |
137 | ```ini
138 | [i18n]
139 | ; The list of languages that is supported
140 | LANGUAGES = en-US
141 | ; The list of user-friendly names of languages
142 | NAMES = English
143 | ```
144 |
145 | ## Target
146 |
147 | The target of documents can be either a local directory or a remote Git address.
148 |
149 | To use a local directory:
150 |
151 | ```ini
152 | [docs]
153 | TYPE = local
154 | TARGET = ./docs
155 | ```
156 |
157 | To use a remote Git address:
158 |
159 | ```ini
160 | [docs]
161 | TYPE = remote
162 | TARGET = https://github.com/asoul-sig/asouldocs.git
163 | ```
164 |
165 | If documents are residing in a subdirectory of the target, use `TARGET_DIR` as follows:
166 |
167 | ```ini
168 | [docs]
169 | TYPE = remote
170 | TARGET = https://github.com/asoul-sig/asouldocs.git
171 | TARGET_DIR = docs
172 | ```
173 |
174 | ## Link to edit page
175 |
176 | You probably want to welcome small contributions from the community if your documentation repository is open sourced. You can navigate users directly to edit the page on the code host:
177 |
178 | ```ini
179 | [docs]
180 | ; The format to construct a edit page link, leave it empty to disable
181 | EDIT_PAGE_LINK_FORMAT = https://github.com/asoul-sig/asouldocs/blob/main/docs/{blob}
182 | ```
183 |
--------------------------------------------------------------------------------
/docs/en-US/howto/sync-through-webhook.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Sync through webhook
3 | ---
4 |
5 | Obviously, you don't want to login to your server and update documentation manually every time you make a change, especially when changes are small and frequent.
6 |
7 | This is a solved problem for the _**ASoulDocs**_ server.
8 |
9 | Just two simple steps:
10 |
11 | 1. [Set up your documentation from a remote Git address](set-up-documentation.md#target)
12 | 1. Fire a webhook whenever there is a `push` event.
13 |
14 | The URL path for receiving the webhook is `/webhook`, and it accepts any kind of HTTP method, GET, POST or HEAD? Cool with that.
15 |
16 | Therefore, a simple `curl` can do the trick:
17 |
18 | ```bash
19 | $ curl http://localhost:5555/webhook
20 | ```
21 |
22 | Almost all code hosts provide builtin webhook, to configurate the webhook on GitHub, navigate to your repository **Settings > Webhooks**, then click on the **Add webhook** button:
23 |
24 | 
25 |
--------------------------------------------------------------------------------
/docs/en-US/howto/use-extensions.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Use extensions
3 | ---
4 |
5 | Every _**ASoulDocs**_ server comes with some builtin extensions, it's just few edits away to use them!
6 |
7 | ## Plausible
8 |
9 | The Plausible extension integrates with https://plausible.io/, it is disabled by default. Use the following configuration to enable it:
10 |
11 | ```ini
12 | [extension.plausible]
13 | ENABLED = true
14 | ; The optional value to be specified for the "data-domain" attribute
15 | DOMAIN =
16 | ```
17 |
18 | ## Google Analytics
19 |
20 | The Google Analytics extension integrates with [Google Analytics 4](https://developers.google.com/analytics/devguides/collection/ga4), it is disabled by default. Use the following configuration to enable it:
21 |
22 | ```ini
23 | [extension.google_analytics]
24 | ENABLED = true
25 | ; The measurement ID of your property
26 | MEASUREMENT_ID = G-VXXXYYYYZZ
27 | ```
28 |
29 | ## Disqus
30 |
31 | The Disqus extension integrates with [Disqus](https://disqus.com/), it is disabled by default. Use the following configuration to enable it:
32 |
33 | ```ini
34 | [extension.disqus]
35 | ENABLED = true
36 | ; The shortname of your site
37 | SHORTNAME = ellien
38 | ```
39 |
40 | ## utterances
41 |
42 | The utterances extension integrates with [utterances](https://utteranc.es/), it is disabled by default. Use the following configuration to enable it:
43 |
44 | ```ini
45 | [extension.utterances]
46 | ENABLED = true
47 | ; The GitHub repository
48 | REPO = owner/repo
49 | ; The issue mapping pattern
50 | ISSUE_TERM = pathname
51 | ; The issue label for comments
52 | LABEL = utterances
53 | ; The theme of the component
54 | THEME = github-light
55 | ```
56 |
--------------------------------------------------------------------------------
/docs/en-US/howto/write-document.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Write document
3 | ---
4 |
5 | Every document is a [Markdown](https://www.markdownguide.org/) file, most of features from [GitHub Flavored Markdown](https://github.github.com/gfm/) are supported through [yuin/goldmark](https://github.com/yuin/goldmark).
6 |
7 | Here is an simple example:
8 |
9 | ```markdown
10 | ---
11 | title: Introduction
12 | ---
13 |
14 | _**ASoulDocs**_ is a stupid web server for multilingual documentation.
15 | ```
16 |
17 | ### Frontmatter
18 |
19 | The frontmatter is a block of YAML snippet, `---` are used to both indicate the start and the end of the snippet.
20 |
21 | Here is an full example of supported fields:
22 |
23 | ```yaml
24 | title: The title of the document
25 | previous:
26 | title: The title of the previous page
27 | link: the relative path to the page
28 | next:
29 | title: The title of the next page
30 | link: the relative path to the page
31 | ```
32 |
33 | - Only the `title` field is required, others all have reasonable default.
34 | - The `link` syntax of both `previous` and `next` sections is exactly same as described in [Links and images](#links-and-images).
35 |
36 | ### Links and images
37 |
38 | Links to other documents or images just works like you would do in any editor (e.g. VSCode):
39 |
40 | - Link to a document under the same directory: `[Customize templates](customize-templates.md)`
41 | - Link to the directory page: `[How to](README.md)`
42 | - Link to a document in another directory: `[Quick start](../introduction/quick-start.md)`
43 | - Link to an image: ``
44 |
45 | ### Code blocks
46 |
47 | The [alecthomas/chroma](https://github.com/alecthomas/chroma) is used to syntax highlighting your code blocks.
48 |
49 | Use name from its [supported languages](https://github.com/alecthomas/chroma#supported-languages) to specify the language of the code block, be sure to replace whitespaces with hyphens (`-`) in the language name, e.g. use `go-html-template` not `go html template` (names are case insensitive).
50 |
51 | To enable line numbers and highlighting lines:
52 |
53 | ```markdown
54 | ...go-html-template {linenos=true, hl_lines=["7-10", 12]}
55 | ```
56 |
57 | ### Render caching
58 |
59 | Each documents is reloaded and re-rendered for every request if the server is running with `dev` environment, as defined in the [configuration file](set-up-documentation.md#configuration-file):
60 |
61 | ```ini
62 | ENV = dev
63 | ```
64 |
65 | Set `ENV = prod` to enable render caching when deploy to production.
66 |
--------------------------------------------------------------------------------
/docs/en-US/introduction/README.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Introduction
3 | previous:
4 | title: Home
5 | path: ../../
6 | ---
7 |
8 | _**ASoulDocs**_ is a stupid web server for multilingual documentation.
9 |
10 | ## Motivation
11 |
12 | Project documentation tools is an already-crowded place yet not being both mature and affordable for individual especially OSS developers. Countless static site generators, documentation servers, SaaS products, unfortunately, we are not happy with any of them. More importantly, we love and are capable of hacking on this area.
13 |
14 | It has been years we struggled with picking one of them, that's basically why _**ASoulDocs**_ was created (previously "Peach" pre-1.0).
15 |
16 | The following table illustrates the features (that we care) comparisons between _**ASoulDocs**_ and other existing tools (that we investigated, concepts may be different from what we understand):
17 |
18 | |Name/Feature |_**ASoulDocs**_|[Mkdocs](https://www.mkdocs.org/)|[Hugo](https://gohugo.io/)|[VuePress](https://v2.vuepress.vuejs.org/)/[VitePress](https://vitepress.vuejs.org/)|[GitBook](https://www.gitbook.com/)|
19 | |:---------------------------:|:-------------:|:----:|:--:|:----------------:|:----:|
20 | |Self-hosted | ✅ | ✅ | ✅ | ✅ | ❌ |
21 | |Multilingual1 | ✅ | ✅ | ✅ | ✅ | ❌ |
22 | |Builtin push-to-sync | ✅ | ❌ | ❌ | ❌ | ✅ |
23 | |DocSearch | 🎯 | ❌ | ✅ | ✅ | ❌ |
24 | |Builtin search | 🎯 | ✅ | ❌ | ✅ | ✅ |
25 | |Commenting system | ✅ | ❌ | ✅ | ❌ | ❌ |
26 | |Versionable | 🎯 | ❌ | ❌ | ❌ | ❌ |
27 | |Protected resources | 🎯 | ❌ | ❌ | ❌ | ❌ |
28 | |Dark mode | ✅ | ❌ | ✅ | ✅ | ❌ |
29 | |Customizable2 | ✅ | ❌ | ✅ | ❌ | ❌ |
30 | |Language fallback3| ✅ | ❌ | ❌ | ❌ | ❌ |
31 |
32 | - 1: None of others support multilingual without changing the URL, which to us is a bizarre because we have to share different URLs for different groups of users.
33 | - 2: In such way that visitors couldn't recognize what is powering the site behind the scene.
34 | - 3: When a page does not exist in the preferred language, fallback to show the version from the default language.
35 | - 🎯: Features that are on the roadmap.
36 |
37 | ## History
38 |
39 | The project was initially named as "Peach Docs" in pre-1.0 releases, which is now branded as _**ASoulDocs**_ starting from the 1.0 release.
40 |
41 | The tech stack has evolved since 2015, [Macaron](https://go-macaron.com) and [Semantic UI](https://semantic-ui.com/) was the new and hot things, and the latest golden partners are [Flamego](https://flamego.dev) and [Tailwind CSS](https://tailwindcss.com/).
42 |
43 | The project is now part of [A-SOUL SIG](https://github.com/asoul-sig) (previously "github.com/peachdocs"), consists a group of A-SOUL fans.
44 |
45 | ## OK, then what?
46 |
47 | [Install the server](installation.md) or go ahead to [Quick start](quick-start.md)!
48 |
--------------------------------------------------------------------------------
/docs/en-US/introduction/installation.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Installation
3 | ---
4 |
5 | ## From binary
6 |
7 | Release binaries are available on [GitHub releases](https://github.com/asoul-sig/asouldocs/releases).
8 |
9 | ## From source code
10 |
11 | Install from source code requires you having a working local environment of [Go](https://go.dev/).
12 |
13 | Use the following command to check:
14 |
15 | ```bash
16 | $ go version
17 | ```
18 |
19 | The minimum requirement version of Go is **1.19**.
20 |
21 | Then build the binary:
22 |
23 | ```bash
24 | $ go build
25 | ```
26 |
27 | Finally, start the server:
28 |
29 | ```bash
30 | $ ./asouldocs web
31 | ```
32 |
33 | Please refer to [Set up your development environment](https://github.com/asoul-sig/asouldocs/blob/main/docs/dev/local_development.md) for local development guide.
34 |
--------------------------------------------------------------------------------
/docs/en-US/introduction/quick-start.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Quick start
3 | ---
4 |
5 | Let's boot up a server serving the documentation of _**ASoulDocs**_ its own!
6 |
7 | At bare minimum, the server requires a `custom/app.ini` file and a local directory where source files of documentation are located.
8 |
9 | 1. Clone the `asoul-sig/asouldocs` repository locally:
10 |
11 | ```bash
12 | $ git clone --depth 1 https://github.com/asoul-sig/asouldocs.git
13 | ```
14 |
15 | 1. Create a `custom/app.ini` file:
16 |
17 | ```bash
18 | $ mkdir custom
19 | $ touch custom/app.ini
20 | ```
21 |
22 | 1. Edit the `custom/app.ini` to tell the server where "docs" directory is located:
23 |
24 | ```ini
25 | [docs]
26 | TARGET = ./asouldocs/docs
27 | ```
28 |
29 | 1. Start the server and visit [http://localhost:5555](http://localhost:5555):
30 |
31 | ```bash
32 | $ asouldocs web
33 | YYYY/MM/DD 00:00:00 [ INFO] ASoulDocs 1.0.0
34 | YYYY/MM/DD 00:00:00 [ INFO] Listen on http://localhost:5555
35 | ```
36 |
37 | Great! Let’s move on to [how to set up documentation](../howto/set-up-documentation.md).
38 |
--------------------------------------------------------------------------------
/docs/toc.ini:
--------------------------------------------------------------------------------
1 | -: introduction
2 | -: howto
3 | -: faqs
4 |
5 | [introduction]
6 | -: README
7 | -: installation
8 | -: quick-start
9 |
10 | [howto]
11 | -: README
12 | -: set-up-documentation
13 | -: write-document
14 | -: sync-through-webhook
15 | -: use-extensions
16 | -: customize-templates
17 | -: run-through-docker
18 | -: configure-reverse-proxy
19 |
--------------------------------------------------------------------------------
/docs/zh-CN/howto/README.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: 如何 ...
3 | ---
4 |
--------------------------------------------------------------------------------
/docs/zh-CN/howto/configure-reverse-proxy.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: 配置反向代理
3 | ---
4 |
5 |
6 | ## Caddy 2
7 |
8 | 通过 [Caddy](https://caddyserver.com/) 可以获得永久免费的 HTTPS:
9 |
10 | ```caddyfile
11 | {
12 | http_port 80
13 | https_port 443
14 | }
15 |
16 | asouldocs.dev {
17 | reverse_proxy * localhost:5555
18 | }
19 | ```
20 |
21 | ## NGINX
22 |
23 | 如下展示了 NGINX 的配置,但具体值需要根据实际情况修改:
24 |
25 | ```nginx
26 | server {
27 | listen 80;
28 | server_name asouldocs.dev;
29 |
30 | location / {
31 | proxy_pass http://localhost:5555;
32 | }
33 | }
34 | ```
35 |
--------------------------------------------------------------------------------
/docs/zh-CN/howto/customize-templates.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: 自定义模板
3 | ---
4 |
5 | 每个[模板文件](set-up-documentation.md#模板文件)都可以通过覆写实现自定义,自定义模板文件需要被放置在 `custom/templates` 目录下(可以通过配置选项 `[page] CUSTOM_DIRECTORY` 指定其它目录)。
6 |
7 | 一般只建议自定义 `home.html` 和 `common/navbar.html` 这两个模板文件来实现最大程度上的向后兼容。
8 |
9 | ## UI 框架
10 |
11 | 页面样式模式使用 [Tailwind CSS](https://tailwindcss.com/) 的 JIT 编译器进行渲染,因此你可以在自定义模板直接使用该框架的所有样式。
12 |
13 | 当然了,并不强求所有服务器都使用 Tailwind CSS 作为 UI 框架,只要在 `custom/common/head.html` 中导入你的自选资源即可。
14 |
15 | ## 本地化
16 |
17 | 服务器使用 Flamego 的 [i18n](https://flamego.cn/middleware/i18n.html) 中间件实现本地化,进行[本地化配置](set-up-documentation.md#本地化配置)的本地化文件需要被放置在 `custom/locale` 目录下(可以通过配置选项 `[i18n] CUSTOM_DIRECTORY` 指定其它目录)。
18 |
19 | 在模板文件中调用本地化函数的语法为 `{{call .Tr "footer::copyright"}}`,其中, `footer` 为分区名,`copyright` 为键名。
20 |
21 | ## 静态资源
22 |
23 | 自定义静态资源需要被放置在 `custom/public` 目录下(可以通过配置选项 `[asset] CUSTOM_DIRECTORY` 指定其它目录)并在模板中导入。
24 |
25 | 假设你有一个路径为 `custom/public/css/my.css` 的自定义静态资源,并在 `custom/common/head.tmpl` 文件中添加如下内容:
26 |
27 | ```go-html-template
28 |
29 | ```
30 |
31 | 注意 `href` 属性并不包含 `public` 前缀。
32 |
--------------------------------------------------------------------------------
/docs/zh-CN/howto/run-through-docker.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: 通过 Docker 运行
3 | ---
4 |
5 | _**一魂文档**_ 的 Docker 镜像可以通过 [Docker Hub](https://hub.docker.com/r/unknwon/asouldocs) 或 [GitHub Container Registry](https://github.com/asoul-sig/asouldocs/pkgs/container/asouldocs) 获取。
6 |
7 | `latest` 标签指向 [`main` 分支](https://github.com/asoul-sig/asouldocs)上的最新构建版本。
8 |
9 | ## 注意事项
10 |
11 | 配置选项 `HTTP_ADDR` 需要被修改为监听 Docker 容器中的网络地址:
12 |
13 | ```ini
14 | HTTP_ADDR = 0.0.0.0
15 | ```
16 |
17 | ## 启动容器
18 |
19 | 你需要挂在 `custom` 目录才能使 Docker 容器成功启动(`/app/asouldocs/custom` 为容器内的对应路径):
20 |
21 | ```bash
22 | $ docker run \
23 | --name=asouldocs \
24 | -p 15555:5555 \
25 | -v $(pwd)/custom:/app/asouldocs/custom \
26 | unknwon/asouldocs
27 | ```
28 |
29 | 如果你的文档目标并不是[远程 Git 地址](set-up-documentation.md#文档目标),则还需要挂载 `docs` 目录(`/app/asouldocs/docs` 为容器内的对应路径):
30 |
31 | ```bash
32 | $ docker run \
33 | --name=asouldocs \
34 | -p 15555:5555 \
35 | -v $(pwd)/custom:/app/asouldocs/custom \
36 | -v $(pwd)/docs:/app/asouldocs/docs \
37 | unknwon/asouldocs
38 | ```
39 |
--------------------------------------------------------------------------------
/docs/zh-CN/howto/set-up-documentation.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: 创建文档仓库
3 | ---
4 |
5 | _**一魂文档**_ 的文档仓库包含以下四个要素:
6 |
7 | 1. 配置文件
8 | 1. 模板文件
9 | 1. 本地化文件
10 | 1. 用户文档
11 |
12 | ## 配置文件
13 |
14 | 每一个文档项目都需要一个配置文件,默认路径为 `custom/app.ini`。
15 |
16 | 每个服务器都会内置一个[默认配置文件](https://github.com/asoul-sig/asouldocs/blob/main/conf/app.ini)为各项配置提供了默认选项,从而使你的文档项目只需要进行几项必要的修改。
17 |
18 | 命令行参数 `--config`(或 `-c`)可以用于指定飞默认路径的配置文件。
19 |
20 | ## 模板文件
21 |
22 | 模板文件使用 [Go HTML 模板](https://pkg.go.dev/html/template)语法渲染各个页面。
23 |
24 | 每个服务器都会内置一批可直接使用的[默认模板文件](https://github.com/asoul-sig/asouldocs/tree/main/templates),但大多数情况下你可能都需要修改 `home.html` 和 `common/navbar.html` 这两个模板文件用于展示与你项目相关的内容。
25 |
26 | 你可以通过在 `custom/templates` 目录下放置对应名称的模板文件来覆写内置模板文件。
27 |
28 | 例如,下面展示了如何将 `common/navbar.html` 中的 GitHub 字样替换为一个笑脸的图案:
29 |
30 | ```go-html-template {hl_lines=["7-10"]}
31 |