unforswearing / todo_markup.js

A minimal (and experimental) markup for todo focused notes.
https://unforswearing.com/todo_markup/
0 stars 0 forks source link

Fix bare url parsing to retain leading `h` #3

Closed unforswearing closed 3 months ago

unforswearing commented 3 months ago

Processing a bare url (a url on its own line) removes the leading h character: ttps://example.com.

Apply fix:

  // parseURL removes the caret char '^' from the start of urls
  const parseURL = (unit) => {
    let unitWords = unit.split(' ')
    for (let g = 0; g < unitWords.length; g++) {
      if (unitWords[g] && unitWords[g].match(fullURL)) {
        let matched = unitWords[g].split('')
        if (matched[0] == '^') matched.shift();
        unitWords[g] = PARSER.URL(matched.join(''))
      }
    }
    return unitWords.join(' ')
  }