How to use the mdurl.encode function in mdurl

To help you get started, we’ve selected a few mdurl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github markdown-it / markdown-it / support / demo_template / index.js View on Github external
'.result-debug-content',
      JSON.stringify(mdSrc.parse(source, { references: {} }), null, 2),
      'json'
    );

  } else { /*defaults._view === 'html'*/
    $('.result-html').html(mdHtml.render(source));
  }

  // reset lines mapping cache on content update
  scrollMap = null;

  try {
    if (source) {
      // serialize state - source and options
      permalink.href = '#md3=' + mdurl.encode(JSON.stringify({
        source: source,
        defaults: _.omit(defaults, 'highlight')
      }), '-_.!~', false);
    } else {
      permalink.href = '';
    }
  } catch (__) {
    permalink.href = '';
  }
}
github markdown-it / markdown-it / lib / index.js View on Github external
if (parsed.hostname) {
    // Encode hostnames in urls like:
    // `http://host/`, `https://host/`, `mailto:user@host`, `//host/`
    //
    // We don't encode unknown schemas, because it's likely that we encode
    // something we shouldn't (e.g. `skype:name` treated as `skype:host`)
    //
    if (!parsed.protocol || RECODE_HOSTNAME_FOR.indexOf(parsed.protocol) >= 0) {
      try {
        parsed.hostname = punycode.toASCII(parsed.hostname);
      } catch (er) { /**/ }
    }
  }

  return mdurl.encode(mdurl.format(parsed));
}
github sx1989827 / DOClever / node_modules / markdown-it / lib / index.js View on Github external
if (parsed.hostname) {
    // Encode hostnames in urls like:
    // `http://host/`, `https://host/`, `mailto:user@host`, `//host/`
    //
    // We don't encode unknown schemas, because it's likely that we encode
    // something we shouldn't (e.g. `skype:name` treated as `skype:host`)
    //
    if (!parsed.protocol || RECODE_HOSTNAME_FOR.indexOf(parsed.protocol) >= 0) {
      try {
        parsed.hostname = punycode.toASCII(parsed.hostname);
      } catch (er) { /**/ }
    }
  }

  return mdurl.encode(mdurl.format(parsed));
}

github christianvoigt / argdown / packages / argdown-parser / lib / src / utils.js View on Github external
if (parsed.hostname) {
    // Encode hostnames in urls like:
    // `http://host/`, `https://host/`, `mailto:user@host`, `//host/`
    //
    // We don't encode unknown schemas, because it's likely that we encode
    // something we shouldn't (e.g. `skype:name` treated as `skype:host`)
    //
    if (!parsed.protocol || RECODE_HOSTNAME_FOR.indexOf(parsed.protocol) >= 0) {
      try {
        parsed.hostname = punycode.toASCII(parsed.hostname);
      } catch (er) {/**/}
    }
  }

  return mdurl.encode(mdurl.format(parsed));
}
github nodeca / nodeca.core / lib / autoload / hooks / responder / response_log.js View on Github external
_.forEach(params, function (value, key) {
      result += result.length ? '&' : '?';
      result += encode(String(key), encode.componentChars);
      result += '=';

      // Don't dump protected params
      if (PROTECTED_PARAMS.indexOf(key) !== -1) result += '****';
      // Do not dump nested objects.
      else if (_.isObject(value)) result += '{...}';
      else result += encode(String(value), encode.componentChars);

      if (result.length > MAX_PARAMS_LOG_LENGTH) {
        result = result.slice(0, MAX_PARAMS_LOG_LENGTH);
        return false; // terminate
      }
    });
github BoostIO / Boostnote / browser / lib / markdown.js View on Github external
const content = token.content.split('\n').slice(0, -1).map(line => {
          const match = /!\[[^\]]*]\(([^\)]*)\)/.exec(line)
          if (match) {
            return mdurl.encode(match[1])
          } else {
            return mdurl.encode(line)
          }
        }).join('\n')
github BoostIO / Boostnote / browser / main / lib / dataApi / attachmentManagement.js View on Github external
return renderedHTML.replace(new RegExp('/?' + STORAGE_FOLDER_PLACEHOLDER + '(?:(?:\\\/|%5C)[\\w.]+)+', 'g'), function (match) {
    var encodedPathSeparators = new RegExp(mdurl.encode(path.win32.sep) + '|' + mdurl.encode(path.posix.sep), 'g')
    return match.replace(encodedPathSeparators, path.sep).replace(new RegExp('/?' + STORAGE_FOLDER_PLACEHOLDER, 'g'), 'file:///' + path.join(storagePath, DESTINATION_FOLDER))
  })
}
github markdown-it / linkify-it / support / demo_template / index.js View on Github external
function updateResult() {
  var source = $('.source').val();

  setLinkifiedContent('.result-html', source);

  if (source) {
    permalink.href = '#t1=' + mdurl.encode(source, mdurl.encode.componentChars);
  } else {
    permalink.href = '';
  }
}
github BoostIO / Boostnote / browser / main / lib / dataApi / attachmentManagement.js View on Github external
function removeStorageAndNoteReferences (input, noteKey) {
  return input.replace(new RegExp(mdurl.encode(path.sep), 'g'), path.sep).replace(new RegExp(STORAGE_FOLDER_PLACEHOLDER + '(' + escapeStringRegexp(path.sep) + noteKey + ')?', 'g'), DESTINATION_FOLDER)
}

mdurl

URL utilities for markdown-it

MIT
Latest version published 1 year ago

Package Health Score

65 / 100
Full package analysis

Similar packages