Project

General

Profile

Actions

Patch #43643

open

Align the Textile processing approach with CommonMark by using Loofah

Added by Takashi Kato 22 days ago. Updated 3 days ago.

Status:
Resolved
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


Related issues

Related to Redmine - Patch #42737: Replacing html-pipeline with Loofah for HTML FilteringClosedMarius BĂLTEANU

Actions
Related to Redmine - Feature #35035: Refactor text formatting to HTML::PipelineNew

Actions
Actions #1

Updated by Marius BĂLTEANU 22 days ago

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

Very nice work!

Actions #2

Updated by Marius BĂLTEANU 18 days ago

  • Related to Patch #42737: Replacing html-pipeline with Loofah for HTML Filtering added
Actions #3

Updated by Marius BĂLTEANU 3 days ago

  • Related to Feature #35035: Refactor text formatting to HTML::Pipeline added
Actions #4

Updated by Marius BĂLTEANU 3 days ago

  • Status changed from New to Resolved

I've committed all three patches. Thanks again for your work on this.

Actions

Also available in: Atom PDF