GitLabWikiStrategy.EncodeWikiPath Method

Namespace
Kampute.DocToolkit
Assembly
  • Kampute.DocToolkit.dll

Definition

Converts the given title to a GitLab Wiki page name that is valid as a file name and as a URL path segment.
public static string EncodeWikiPath(ReadOnlySpan<char> title)

Parameters

title ReadOnlySpan<char>
The title to encode.

Returns

string
The encoded title.

Remarks

This method converts the title as follows:
  • Spaces are replaced with hyphens, which GitLab displays as spaces.
  • Angle brackets (< and >) are replaced with braces ({ and }), so List<T> becomes List{T}.
  • Characters that are not allowed in file names or have a special meaning in URLs (:, ", /, \, |, ?, *, #, %) are replaced with underscores.
  • All other characters are left unchanged.