gjbarnard / moodle-filter_synhi

Syntax highlighter
GNU General Public License v3.0
2 stars 2 forks source link

non latin characters before the code block break highlighting #12

Closed a-kempka closed 1 year ago

a-kempka commented 1 year ago

Describe the bug using non latin characters such as ä ö ü ß breaks code highlighting

To Reproduce Steps to reproduce the behaviour:

  1. create label with the following HTML
    <h3>Umlaut breaks highlighting</h3>
    <p>code highlighting breaks when using non latin characters: ä ü ß ö - each character cuts makes one char of the not to be highlichted code tag appear</p>
    <pre><code>
    # This is a Python program that calculates the sum of two numbers
    num1 = 5
    num2 = 10
    sum = num1 + num2
    print("The sum of", num1, "and", num2, "is:", sum)
    </code>
    </pre>

    The code and pre tag are highlighted as well. The more umlauts you insert, the more characters of the parts after the code are displayed, i.e. the closing tags (code and pre) are highlighted and break the subsequent HTML.

Expected behaviour The code highlighting should end at "sum)"

Screenshots image

Versions (please complete the following information):

gjb2048 commented 1 year ago

@a-kempka Thanks for the report, please apply https://github.com/gjb2048/moodle-filter_synhi/commit/c4947181dab95e6705ce06da16d070053c85a1d5 and confirm it fixes it for you.

gjb2048 commented 1 year ago

Release https://moodle.org/plugins/filter_synhi/39.1.1/28905

a-kempka commented 1 year ago

Thank you for the quick fix. Umlauts don't interfere with SynHi now.

gjb2048 commented 1 year ago

@a-kempka Thanks for letting me know.