Merge pull request 'expand description of built-in wiki' (#147) from wiki into master

Reviewed-on: https://codeberg.org/Codeberg/Documentation/pulls/147
This commit is contained in:
René W 2021-07-03 21:46:04 +02:00
commit 740cb20b58
5 changed files with 74 additions and 47 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

View file

@ -1,31 +0,0 @@
---
eleventyNavigation:
key: ThirdPartyTools
title: Including images in wiki pages
parent: AdvancedUsage
---
## Uploading images via git
Currently, Gitea supports only images in the base directory of the wiki Git. (Gitea wiki pages are stored in a separate wiki right beside the project, wiki pages themselves are markdown files).
A feasible workflow might look like this (replace `<user>` and `<project>` with your user and project name):
```shell
git clone git@codeberg.org:<user>/<project>.wiki.git
cd <project>.wiki.git
## now copy image file into this folder
git add <codeberg.png>
git commit -m "add image"
git push
```
Now, you can reference the image in Markdown, like this:
```markdown
![image alt text](codeberg.png "image title")
```
After saving your changes, the image should be visible.
*NOTE: In contrast to embedding external images, images in Git are only rendered after saving the wiki or markdown file changes.*

View file

@ -1,16 +0,0 @@
---
eleventyNavigation:
key: WikiBasics
title: Contributing to Wikis
parent: GettingStarted
order: 50
draft: true
---
The term wikiwiki comes from Hawaii and means 'fast' or 'with speed'. Wiki is a collaborative space on the Web that is usually edited online. It is a common practice to use Wikis to collect knowledge and share information.
You can edit Wikis in plain text markdown and preview it.
In the settings for your project, under 'Advanced Settings' there is a choice where you can use Built-in Wiki or provide URL for external one if you already have it hosted somewhere else. You can also completely disable it if you don't need it.
You can read about how to include images in wiki pages [here](https://docs.codeberg.org/advanced/images-in-wiki-pages/).

View file

@ -0,0 +1,73 @@
---
eleventyNavigation:
key: Wiki
title: Integrated Wiki
parent: GettingStarted
order: 60
---
A [Wiki](https://en.wikipedia.org/wiki/Wiki) is a collaborative space on the web. It is a common practice to use Wikis to collect knowledge and share information.
Codeberg allows you to add a Wiki to a repo for additional documentation.
The user in these examples is `knut` the polar bear and its repository is `foobar`.
## Activation and Permissions
To enable the Wiki for a repository, visit the `Settings` page and activate `Enable Repository Wiki` in the `Advanced Section`. It will default to the built-in wiki which is described here, but you can as well add an URI to an external site the "Wiki" tab should link to (not part of this doc).
> **Warning**
> Be aware that the wiki, once enabled, is accessible for *everyone* who has `read` access your repository - on public repositories even unauthenticated guests can access the wiki.
> The wiki is *not* a suitable place for storing private information or secrets (like passwords).
To edit the Wiki `write` permission to the repository is required.
## Wiki structure
The Wiki is essentially a separate Git repo in your repository with a predefined name in the form of `<your-repository-name>.wiki.git`.
It consists of [Markdown](https://en.wikipedia.org/wiki/Markdown) files (file extension `.md`) and additional assets like images.
No further style sheets are needed. The markdown files are automatically rendered according to the selected Codeberg theme.
## Adding content via web
After you have enabled the Wiki you are asked to create the initial page `Home.md`.
Using the web UI in your browser is currently limited to add/update/delete pages, you can not manage assets like images this way.
<picture>
<source srcset="/assets/images/getting-started/wiki/wiki_pageview.png" type="image/png">
<img src="/assets/images/getting-started/wiki/wiki_pageview.png" alt="Wiki home page with edit buttons">
</picture>
## Adding content via a local Git client
You can work with the Wiki repo as with any other Git repo on Codeberg, see our docs about managing a Git repo [via CLI](https://docs.codeberg.org/git/clone-commit-via-cli).
```shell
git clone git@codeberg.org:knut/foobar.wiki.git
cd foobar.wiki
nano Home.md
git commit -am "create Home page"
```
Editing locally allows you to use your favorite editor (preferably with markdown syntax check and highlighting) and manage additional assets like images.
### Adding images
You could add images to the root directory or a specific subfolder (like `assets` or `images`) using your local Git client.
A feasible workflow might look like this:
```shell
# create a subfolder for images
mkdir images
cd images
# copy the image file into this folder
git add images/image.png
git commit -m "add image"
git push
```
Now, you can reference the image in Markdown, like this:
```markdown
![image alt text](images/image.png "image title")
```
After saving your changes, the image should be visible.
> In contrast to embedding external images, images in Git are only rendered after saving the wiki or markdown file changes.

View file

@ -7,6 +7,7 @@ pagination:
redirects:
- {"from": "/git/clone-commit-via-ssh/", "to": "/git/clone-commit-via-cli/"}
- {"from": "/git/clone-commit-via-http/", "to": "/git/clone-commit-via-cli/"}
- {"from": "/advanced/images-in-wiki-pages/", "to": "/getting-started/wiki/"}
permalink: "{{ redirect.from }}"
layout: redirect
---