Skip to content

Code blocks in Wiki are rendered with arbitrary syntax highlighting instead of none #11825

Closed
@qwertfisch

Description

@qwertfisch

Description

When adding a code block on a page in the built-in wiki, but with no language given for syntax highlighting, this block will be rendered using an arbitrarily chosen highlighting. Code blocks without selected syntax I will set like this:

```
This is simple text rendered with fixed-width font,
but no syntax highlighting.
```

Even if the text inside the block would contain keywords for some languages, I do not expect them to be highlighted or rendered other than as fixed-width font. In fact when given no language for the code block, I expect the language to be None.

Actual result

When selecting the preview window, or after storing the page, a second later a seemingly arbitrarily chosen syntax highlighting is applied to the block. On the example page I added some keywords (for some languages), and the two blocks are rendered as Cal and Vim, respectively. It seems the highlighting is selected automatically given the content of the block.

Workaround

I can enclose the block with <pre> / </pre> instead of Markdown. Is there otherwise a possibility to have a non-syntaxed code block with Markdown syntax?
Edit: <pre> does not set the content to a fixed-width font, so this is unfortunately no solution.

Is this a bug for Gitea? Or should I file a bug on the Markdown interpreter used (goldmark?).

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/enhancementAn improvement of existing functionality

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions