mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 10:02:59 +08:00
refactor(read_only_code): add comment about potential bug
will need to be confirmed first though, by the unit tests that I will write
This commit is contained in:
parent
622945ab18
commit
1dc5452cd0
@ -70,6 +70,13 @@ export default class ReadOnlyCodeTypeWidget extends AbstractCodeTypeWidget {
|
||||
|
||||
html = html
|
||||
// match everything, including whitespace/newline characters
|
||||
// TriliumNextTODO: this only seems to replace the very first occurence of a "pre" tag.
|
||||
// => the i++ makes it look like this isn't on purpose though.
|
||||
// The "dot" is also matching too greedy, i.e. it matches everything in between the first and last pre tag,
|
||||
// even if there other pre-tags nested (which is valid HTML apparently). The fix would be:
|
||||
// a) add the g flag for matching more than one ocurrence
|
||||
// b) add "?" as lazy quantifier after the "+" like so
|
||||
// /<pre>((.)+?)<\/pre>/g
|
||||
.replace(/<pre>((.)+)?<\/pre>/s, (match) => {
|
||||
pre.push({ indent: "", tag: match });
|
||||
return `<--TEMPPRE${i++}/-->`;
|
||||
|
Loading…
x
Reference in New Issue
Block a user