debian-mirror-gitlab/doc/development/wikis.md

96 lines
4.9 KiB
Markdown
Raw Normal View History

2021-01-03 14:25:43 +05:30
---
2021-01-29 00:20:46 +05:30
stage: Create
2021-03-11 19:13:27 +05:30
group: Editor
2022-11-25 23:54:43 +05:30
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments
2021-01-03 14:25:43 +05:30
description: "GitLab's development guidelines for Wikis"
---
2023-03-17 16:20:25 +05:30
# Wikis development guide
2021-01-03 14:25:43 +05:30
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/227027) in GitLab 13.5.
## Overview
2021-03-11 19:13:27 +05:30
The wiki functionality in GitLab is based on [Gollum 4.x](https://github.com/gollum/gollum/).
2023-04-23 21:23:45 +05:30
It's used in the [Gitaly](gitaly.md) Ruby service, and accessed from the Rails app through Gitaly RPC calls.
2021-01-03 14:25:43 +05:30
Wikis use Git repositories as storage backend, and can be accessed through:
- The [Web UI](../user/project/wiki/index.md)
- The [REST API](../api/wikis.md)
2021-04-29 21:17:54 +05:30
- [Git itself](../user/project/wiki/index.md#create-or-edit-wiki-pages-locally)
2021-01-03 14:25:43 +05:30
[Introduced](https://gitlab.com/groups/gitlab-org/-/epics/2214) in GitLab 13.5, wikis are also available
for groups, in addition to projects.
## Involved Gems
Some notable gems that are used for wikis are:
| Component | Description | Gem name | GitLab project | Upstream project |
|:--------------|:-----------------------------------------------|:-------------------------------|:--------------------------------------------------------------------------------------------------------|:--------------------------------------------------------------------|
| `gitlab` | Markup renderer, depends on various other gems | `gitlab-markup` | [`gitlab-org/gitlab-markup`](https://gitlab.com/gitlab-org/gitlab-markup) | [`github/markup`](https://github.com/github/markup) |
| `gitaly-ruby` | Main Gollum library | `gitlab-gollum-lib` | [`gitlab-org/gollum-lib`](https://gitlab.com/gitlab-org/gollum-lib) | [`gollum/gollum-lib`](https://github.com/gollum/gollum-lib) |
| | Gollum Git adapter for Rugged | `gitlab-gollum-rugged_adapter` | [`gitlab-org/gitlab-gollum-rugged_adapter`](https://gitlab.com/gitlab-org/gitlab-gollum-rugged_adapter) | [`gollum/rugged_adapter`](https://github.com/gollum/rugged_adapter) |
| | Rugged (also used in Gitaly itself) | `rugged` | - | [`libgit2/rugged`](https://github.com/libgit2/rugged) |
### Notes on Gollum
We only use Gollum as a storage abstraction layer, to handle the mapping between wiki page slugs and files in the repository.
When rendering wiki pages, we don't use Gollum at all and instead go through a
2021-09-04 01:27:46 +05:30
[custom Banzai pipeline](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/banzai/pipeline/wiki_pipeline.rb).
2023-04-23 21:23:45 +05:30
This adds some [wiki-specific markup](../user/markdown.md#wiki-specific-markdown), such as the Gollum `[[link]]` syntax.
2021-01-03 14:25:43 +05:30
2023-04-23 21:23:45 +05:30
Because we do not make use of most of the Gollum features, we plan to move away from it entirely at some point.
2021-01-03 14:25:43 +05:30
[See this epic](https://gitlab.com/groups/gitlab-org/-/epics/2381) for reference.
## Model classes
The `Wiki` class is the main abstraction around a wiki repository, it needs to be initialized
with a container which can be either a `Project` or `Group`:
```mermaid
classDiagram
Wiki --> ProjectWiki
Wiki --> GroupWiki
class Wiki {
#container
#repository
}
class ProjectWiki {
#project#container
}
class GroupWiki {
#group#container
}
```
Some models wrap similar classes from Gitaly and Gollum:
| Rails Model | Gitaly Class | Gollum |
|:------------|:--------------------------------------------------------|:---------------|
| `Wiki` | `Gitlab::Git::Wiki` | `Gollum::Wiki` |
| `WikiPage` | `Gitlab::Git::WikiPage`, `Gitlab::Git::WikiPageVersion` | `Gollum::Page` |
| | `Gitlab::Git::WikiFile` | `Gollum::File` |
Only some data is persisted in the database:
| Model | Description |
|:----------------------|:-----------------------------------------|
| `WikiPage::Meta` | Metadata for wiki pages |
| `WikiPage::Slug` | Current and previous slugs of wiki pages |
| `ProjectRepository` | Gitaly storage data for project wikis |
| `GroupWikiRepository` | Gitaly storage data for group wikis |
## Attachments
The web UI uploads attachments through the REST API, which stores the files as commits in the wiki repository.
2021-04-29 21:17:54 +05:30
## Related topics
- [Gollum installation instructions](https://github.com/gollum/gollum/wiki/Installation)