0
0
Fork 0
mirror of https://codeberg.org/forgejo/docs.git synced 2024-11-21 17:36:59 -05:00

Document the new preview of permalinks

This commit is contained in:
Mai-Lapyst 2024-04-05 04:43:22 +02:00 committed by Earl Warren
parent e686086717
commit b47946be04
4 changed files with 24 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

View file

@ -1107,6 +1107,7 @@ This section only does "set" config, a removed config key from this section won'
## Markup (`markup`) ## Markup (`markup`)
- `MERMAID_MAX_SOURCE_CHARACTERS`: **5000**: Set the maximum size of a Mermaid source. (Set to -1 to disable) - `MERMAID_MAX_SOURCE_CHARACTERS`: **5000**: Set the maximum size of a Mermaid source. (Set to -1 to disable)
- `FILEPREVIEW_MAX_LINES`: **50**: Set the maximum number of lines allowed for a filepreview. (Set to -1 to disable limits; set to 0 to disable the feature)
Forgejo can support Markup using external tools. The example below will add a markup named `asciidoc`. Forgejo can support Markup using external tools. The example below will add a markup named `asciidoc`.

View file

@ -47,6 +47,29 @@ Example:
> This bug was introduced in [e59ff077](#) > This bug was introduced in [e59ff077](#)
## Code references
It is possible to reference any portion of a file in a repository, by using the permalink feature inside the file viewer:
![Permalinking of a line range](../_images/user/linked-references/permalink-coderange.png)
If used inside a issue or pull request, this is automatically rendered into a inline preview of the portion of that file.
> **NOTE:** Alternatively, you also can use the "Reference in a new issue" action to automatically create an issue with the correct permalink.
Example:
> See the code here: https://next.forgejo.org/Mai-Lapyst/test/src/commit/66719555bd242b9ad7c3fb9eef2b388826d87872/hook.go#L191-L200 It set's all of the options for this.
![Rendered result of an permalink code reference](../_images/user/linked-references/rendered-permalink.png)
There are some restrictions in place:
- Code linked in private repositories will not be displayed if the current viewer has insufficent permissions.
- It can only ever be a permalink; means linking to files by a branch or tag will not result in a preview.
- There is a maximum amount of lines that will be rendered. By default this is 50.
- Only permalinks to the current instance will work.
## Issues and Pull Requests ## Issues and Pull Requests
A reference to another issue or pull request can be created using the simple A reference to another issue or pull request can be created using the simple