Python docstrings are not rendered properly in some cases
Summary
In some very specific cases, in GitLab file view, Python docstrings are not parsed/recognized properly.
Steps to reproduce
See https://gitlab.com/skontar/test-bug/-/blob/main/bug.py lines 70-80 This is a issue reproducer, but I am facing the problem in a real code with similar structure. It has something to do with specific order, number of lines, combination of lines etc. It took me an hour to reproduce the problem, because very often random change in the code made the problem disappear.
Example Project
https://gitlab.com/skontar/test-bug
What is the current bug behavior?
The last docstring opening and closing tags (""") is not recognized properly, leading to inverted docstring syntax highlight.
What is the expected correct behavior?
Correct syntax highlight. Other GitLab views get it right, for example: https://gitlab.com/skontar/test-bug/-/blame/main/bug.py
Relevant logs and/or screenshots
Output of checks
This bug happens on GitLab.com
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: \`sudo gitlab-rake gitlab:env:info\`) (For installations from source run and paste the output of: \`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production\`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:check SANITIZE=true`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true`) (we will only investigate if the tests are passing)
