Project

General

Profile

Actions

Patch #43643

open

Align the Textile processing approach with CommonMark by using Loofah

Added by Takashi Kato about 23 hours ago. Updated about 6 hours ago.

Status:
New
Priority:
Normal
Category:
Code cleanup/refactoring
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:

Description

The attached patches enable the use of Loofah and Scrubber for Textile Wiki formatting, similar to CommonMark.
This allows processing for Wiki content, such as Tablesort, adding copy buttons to code blocks, and Syntaxhighlight, to be extracted as Scrubbers and shared between Textile and CommonMark.

Changes in patch 1:

  • Add TablesortScrubber to both CommonMark and Textile Formatters.
    • It will now be determined on the server-side whether to use tablesort.
  • Add tablesort_controller.js to enable tablesort.
    • tablesort has been updated to v5.7.0 and converted to ESM .
    • Since tablesort is used via stimulus, there is no longer a need to execute the setupWikiTableSortableHeader function every time the DOM is updated.

Changes in patch 2:

  • Add SyntaxHighlightScrubber to Textile.
  • Commonize parts of SyntaxHighlight processing that can be shared between Textile and CommonMark.

Changes in patch 3:

  • Add CopypreScrubber to both CommonMark and Textile Formatters.
    • Adding copy buttons to Wiki code blocks will be done on the server-side.
  • Add clipboard_controller.js to copy text to the clipboard via stimulus.
    • Since stimulus is used, there is no longer a need to execute the setupCopyButtonsToPreElements function every time the DOM is updated.

Notes:

  • Since Loofah will also be used on the Textile side, the HTML output will conform to HTML5.
  • Redmine::WikiFormatting:Textile included ActionView::Helpers::TagHelper, but it was not actually used, so it has been removed.
  • Considering the performance issue in #43446 , I took benchmarks in the same way. The processing time has become slightly longer due to the increased number of Scrubbers. The numbers are as follows.

Before applying the patch

Textile Average: 56.27 ms
CommonMark Average: 47.45 ms

After applying the patch

Textile Average: 65.18 ms
CommonMark Average: 54.29 ms

Files

Actions #1

Updated by Marius BĂLTEANU about 6 hours ago

  • Assignee set to Marius BĂLTEANU
  • Target version set to 7.0.0

Very nice work!

Actions

Also available in: Atom PDF