Details
-
Bug
-
Status: Reopened
-
Major
-
Resolution: Unresolved
-
4.0 regressions
-
None
Description
Issue occurred upon update to Moodle 4.0.6 and 4.1.1. Did not exist in prior version.
When using MarkdownExtra, cannot add custom data- attributes into code blocks anymore. Certain attributes such as lang, class still work.
Steps:
1) Login as a user who has page editing permissions.
2) Change editor to PlainText.
3) Edit the page and "Add an activity or resource" of "Text and media area" in an arbitrary section.
4) Change the editor to Markdown and paste in the below valid MarkdownExtra code:
``` {.someclass lang=en data-foo=bar}
|
def somecode():
|
print("Hello World") |
somecode()
|
```
|
5) Save and return.
6) Inspect the element.
What was expected:
Inspected code element having attributes:
<code class="someclass" lang="en" xml:lang="en" data-foo="bar" ...
What actually happens:
Inspected code element has the following attributes:
<code class="someclass" lang="en" xml:lang="en" ...
Some attributes like lang and class are not stripped out. Data-attributes are removed.
Why this matters:
https://github.com/fastsandslash/moodle-filter_ace_inline
Is a filter I am wanting to submit to the Moodle Repository.
https://coderunner.org.nz/mod/page/view.php?id=545
Is expected usage and behaviour.
The use of MarkdownExtra is one of the supported methods of easy code creation for users, especially if importing questions created outside of Moodle.