Skip to content

Commit

Permalink
Improved Markdown parser.
Browse files Browse the repository at this point in the history
  • Loading branch information
petersirka committed Sep 14, 2024
1 parent 1eaa0ab commit 1f3ed69
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- fixed inline declared middleware `&middleware` in the `ROUTE()` method
- fixed partial validation
- fix image bug in the `Image.measureWEBP()` method by [Marek Mraz](https://github.com/Mrazbb)
- improved Markdown parser

========================
0.0.97
Expand Down
5 changes: 3 additions & 2 deletions markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const REG_ICONS = /(^|[^\w]):((fab|far|fas|fal|fad|fa|ti)\s(fa|ti)-)?[a-z-]+:([^
const REG_KEYWORDS = /\{.*?\}\(.*?\)/g;
const REG_LINKEXTERNAL = /(https|http):\/\//;
const REG_FORMAT = /__.*?__|_.*?_|\*\*.*?\*\*|\*.*?\*|~~.*?~~|~.*?~/g;
const REG_ORDERED = /^[a-z|0-9]{1,3}\.\s|^-\s/i;
const REG_ORDERED = /^[a-z|0-9]{1,3}\.\s|^(-|\*|\+)\s/i;
const REG_ORDEREDSIZE = /^(\s|\t)+/;
const REG_CODE = /`.*?`/g;
const REG_ENCODETAGS = /<|>/g;
Expand Down Expand Up @@ -732,7 +732,8 @@ String.prototype.markdown = function(opt, nested) {
else
size = 0;

var ultype = tmpline.charAt(0) === '-' ? 'ul' : 'ol';
var c = tmpline.charAt(0);
var ultype = c === '-' || c === '*' || c === '+' ? 'ul' : 'ol';
var tmpstr = (ultype === 'ol' ? tmpline.substring(tmpline.indexOf('.') + 1) : tmpline.substring(2));
var istask = false;

Expand Down

0 comments on commit 1f3ed69

Please sign in to comment.