Skip to content

Fix incorrect text escaping in Toast UI/Static Site Editor

Enrique Alcántara requested to merge fix-sse-escaping-sequences into master

What does this MR do?

When editing a markdown document that contains custom Markdown syntax like Kramdown or GFM with the Static Site Editor, Toast UI (the underlying editor used by the SSE) applies text escaping to the markdown syntax it does not know how to interpret, for example:

Before opening the document with the Static Site Editor

{:.no_toc .hidden-md .hidden-lg}

- TOC
{:toc .hidden-md .hidden-lg}

[Text to display][identifier] will display a link.

will do the same. Hover [Another text][another-identifier] the mouse over it to see the title.

[This link] will do the same as well. It works as the identifier itself.

[This link][] (same as above), has a second pair of empty brackets to indicate that the following parenthesis does not contain a link.

[another-identifier]: https://example.com "This example has a title"
[identifier]: http://example1.com
[this link]: http://example2.com
[this `code` link]: http://example2.com
[`this code link`]: http://example2.com


<kbd class="required">Required 🔎</kbd>

After opening the document with the Static Site Editor

{:.no\_toc .hidden-md .hidden-lg}

* TOC
{:toc .hidden-md .hidden-lg}

\[Text to display\]\[identifier\] will display a link\.

will do the same\. Hover \[Another text\]\[another\-identifier\] the mouse over it to see the title\.

[This link] will do the same as well. It works as the identifier itself.

\[This link\]\[\] \(same as above\)\, has a second pair of empty brackets to indicate that the following parenthesis does not contain a link\.

\[another\-identifier\]: https://example\.com "This example has a title"

\[identifier\]: http://example1\.com

\[this link\]: http://example2\.com

<kbd class="required">Required 🔎</kbd>

This merge request fixes this issue by overwriting the HTML to Markdown converter used by Toast UI for text nodes.

How to test?

  • Create a file named page.md in a repository with the content of the example above.
  • Open the file in the Static Site Editor https://localhost:3000/[project-full-path]/-/sse/master%2Fpage.md.

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Enrique Alcántara

Merge request reports