Feature #41294 » 0008-Modified-to-simpler-implementation-and-improved-code-comments.patch
app/assets/javascripts/quote_reply.js | ||
---|---|---|
77 | 77 |
// Remove all unnecessary anchor elements |
78 | 78 |
fragment.querySelectorAll('a.wiki-anchor').forEach(e => e.remove()); |
79 | 79 | |
80 |
// Adjust line breaks when output as text |
|
81 | 80 |
const html = this.adjustLineBreaks(fragment.innerHTML); |
82 | 81 | |
83 | 82 |
const result = document.createElement('div'); |
... | ... | |
171 | 170 |
} |
172 | 171 |
}); |
173 | 172 | |
174 |
// Table elements are not formatted, and the within the table is output as is. |
|
173 |
// Table does not maintain its original format, |
|
174 |
// and the text within the table is displayed as it is |
|
175 | 175 |
// |
176 | 176 |
// | A | B | C | |
177 | 177 |
// |---|---|---| |
... | ... | |
180 | 180 |
// A B C |
181 | 181 |
// 1 2 3 |
182 | 182 |
turndownService.addRule('table', { |
183 |
filter: (node, options) => { |
|
184 |
return node.nodeName === 'TD' || node.nodeName === 'TH'; |
|
185 |
}, |
|
183 |
filter: ['td', 'th'], |
|
186 | 184 |
replacement: (content, node) => { |
187 | 185 |
const separator = node.parentElement.lastElementChild === node ? '' : ' '; |
188 | 186 |
return content + separator; |
... | ... | |
207 | 205 |
// <h1>Title1<a href="#Title" class="wiki-anchor">¶</a></h1> => <h1>Title1</h1> |
208 | 206 |
htmlFragment.querySelectorAll('a.wiki-anchor').forEach(e => e.remove()); |
209 | 207 | |
210 |
// Convert code highlight blocks to CommonMark code blocks. |
|
208 |
// Convert code highlight blocks to CommonMark format code blocks.
|
|
211 | 209 |
// <code class="ruby" data-language="ruby"> => <code class="language-ruby" data-language="ruby"> |
212 | 210 |
htmlFragment.querySelectorAll('code[data-language]').forEach(e => { |
213 | 211 |
e.classList.replace(e.dataset['language'], 'language-' + e.dataset['language']) |