%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /data/old/usr/lib/node_modules/hexo/lib/plugins/helper/
Upload File :
Create Path :
Current File : //data/old/usr/lib/node_modules/hexo/lib/plugins/helper/link_to.js

'use strict';

const { htmlTag, url_for } = require('hexo-util');

function linkToHelper(path, text, options = {}) {
  if (typeof options === 'boolean') options = {external: options};

  if (!text) text = path.replace(/^https?:\/\/|\/$/g, '');

  const attrs = Object.assign({
    href: url_for.call(this, path),
    title: text
  }, options);

  if (attrs.external) {
    attrs.target = '_blank';
    attrs.rel = 'noopener';
    attrs.external = null;
  }

  if (attrs.class && Array.isArray(attrs.class)) {
    attrs.class = attrs.class.join(' ');
  }

  return htmlTag('a', attrs, text);
}

module.exports = linkToHelper;

Zerion Mini Shell 1.0