Skip to content

Commit

Permalink
Fix mdfx space (#51)
Browse files Browse the repository at this point in the history
* MDFX now properly handles escaped characters in the markdown text.

* fixed changelog
  • Loading branch information
FlorianKirmaier authored Dec 9, 2024
1 parent 6872488 commit ddcd43b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#### Bugfixes
* Resolved an issue in the native implementation of `FileOpenPicker` and `FileSavePicker` within the `jpro-file` module
that prevented the addition of duplicate event handlers to the provided node.
* MDFX now properly handles escaped characters in the markdown text.

----------------------

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package one.jpro.platform.mdfx.impl;

import com.vladsch.flexmark.util.sequence.Escaping;
import one.jpro.platform.mdfx.MarkdownView;
import com.vladsch.flexmark.ast.*;
import com.vladsch.flexmark.ext.attributes.AttributeNode;
Expand Down Expand Up @@ -385,12 +386,12 @@ public void visit(com.vladsch.flexmark.ast.TextBase text) {
public void visit(com.vladsch.flexmark.ast.Text text) {
visitor.visitChildren(text);

String wholeText = text.getChars().normalizeEOL();
String wholeText = Escaping.unescapeString(text.getChars().normalizeEOL());

String[] textsSplit;
if (nodePerWord) {
// split with " " but keep the " " in the array
textsSplit = text.getChars().normalizeEOL().split("(?<= )");
textsSplit = wholeText.split("(?<= )");
// Combine split texts, which only contain a space:
for (int i = 0; i <= textsSplit.length - 1; i += 1) {
if (textsSplit[i].equals(" ")) {
Expand All @@ -408,7 +409,7 @@ public void visit(com.vladsch.flexmark.ast.Text text) {
}
} else {
textsSplit = new String[1];
textsSplit[0] = text.getChars().normalizeEOL();
textsSplit[0] = wholeText;
}
final String[] textsSplitFinal = textsSplit;

Expand Down

0 comments on commit ddcd43b

Please sign in to comment.