Skip to content

Commit

Permalink
md stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
targoninc-alex committed Apr 28, 2024
1 parent 2bf692c commit 8ee614b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ui/js/MarkdownProcessor.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,22 @@ export class MarkdownProcessor {
// Keep examining the text until all formatting has been extracted
while (text.length > 0) {
// Find the nearest formatting
let nearest = {index: text.length};
let nearest = {
index: text.length
};
let nearestType;

for (let type of formattingTypes) {
const match = type.regex.exec(text);
if (match && match.index < nearest.index) {
console.log(match, type.name);
nearest = match;
nearestType = type.name;
}
}

// Add the text preceding the nearest match (if any) and the nearest match (if any) to the elements
if (nearest.index > 0) {
if (nearest.index > -1) {
const element = {
type: 'text',
text: text.substring(0, nearest.index)
Expand Down

0 comments on commit 8ee614b

Please sign in to comment.