Skip to content

Markdown may eat code blocks following a list #20324

Closed
@HermannDppes

Description

@HermannDppes

Description

When having a fenced code block in a Markdown file after an empty list item, the entire code block or parts of it may be ignored in the rendered Markdown view of Gitea as if the lines were not present within the Markdown file.

Completely vanishing code block

If no lines which are indented at least two spaces are present in the code block, it gets ignored in its entirety. As an example where you'll have to ignore the backslashes I inserted because I'm unable to stack Markdown properly, a file containing

*
\```
some code goes here
\```

would be rendered identically (as far as my eyes may discern) to a file having

*

as its only content.

Partially vanishing code block

If at least one line is indented at least two spaces, everything up to but not including the first of these lines is ignored. So the file with

*
\```
unindented code
 single space indented code
  double space indented code
unindented code
   triple space indented code
\```

renders just like

*
  double space indented code
unindented code
   triple space indented code
\```

would have rendered.

Tabs

I have not yet tested tabs because I noticed the issue just today and quickly went to the online editor to produce MWEs where tabs were not available to me. For all I know, a tab indentation may behave similarly to space indentation or completely differently.

Gitea Version

1.16.8

Can you reproduce the bug on the Gitea demo site?

No, since it wanted me to jump through some hoops to make an account there and I was in no mood to jump through any more hoops today. Maybe tomorrow.

Screenshots

grafik
grafik
grafik
grafik
grafik
grafik
grafik
grafik

Operating System

Debian 10 (Buster)

How are you running Gitea?

From a downloaded binary via systemd and behind a reverse proxy with Nginx.

Database

MySQL

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions