Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default function url(opts) {
const defaultOptions = {
attributes: {},
// setting this to true will mess up characters like "
escape: false
}
const { attributes, escape } = extend({}, defaultOptions, opts)
return {
id,
async transform(options) {
return extend({}, options, {
result: linkify(options.result, { attributes, escape })
})
}
}
}
const pluginOptions = presetOptions[id]
if (presetOptions.exclude.indexOf(plugin.id) === -1) {
if (id === "youtube" || id === "map") {
return plugin(
extend(
{},
{
gAuthKey: options.gAuthKey
},
pluginOptions
)
)
} else if (id === "noEmbed") {
return plugin(
extend({}, pluginOptions, {
exclude: ["youtube"]
})
)
}
return plugin(pluginOptions)
}
return null
})
export default opts => {
const defaultOptions = {
_replaceAnyways: false,
_ignoreAnchorCheck: false,
_ignoreInlineCheck: false,
onLoad() {}
}
const pluginOptions = extend({}, defaultOptions, opts)
const { _onLoadInternal, onLoad, regex, template, id } = pluginOptions
if (!regex) {
throw new Error("regex not passed.")
}
if (!template) {
throw new Error("template not passed.")
}
return {
id,
async transform(options) {
return extend({}, options, await insert(options, pluginOptions))
},
(acc, key, value) => {
return extend(acc, value.utils);
},
{}
const LocaleProvider = (props: {
locale: $Shape,
children: ?React.Node,
}) => {
const {locale, children} = props;
return (
{children}
);
};
return replacer.apply(null, args).then(function(res) {
return extend({}, match, { replacement: res })
})
}
id,
regex: /(`{3})(\s|[a-z]+)\s*([\s\S]*?[^`])\s*\1(?!`)/gm,
prismjs: !isBrowser ? global.Prism : window.Prism,
template(args, options, { prismjs }) {
const language = args[2] === "\n" || !args[2] ? "markup" : args[2]
const code = args[3]
const className = `language-${language}`
return `<pre class="${className}"><code class="${className}">${prismjs.highlight(
code,
prismjs.languages[language]
)}</code></pre>`
}
}
const pluginOptions = extend({}, defaultOptions, opts, {
_replaceAnyways: true,
_ignoreAnchorCheck: true,
_ignoreInlineCheck: true
})
if (!pluginOptions.prismjs) {
throw new Error(
"You need to load prismjs as a global variable or pass it in options."
)
}
return base(pluginOptions)
}
async template(
args,
options,
pluginOptions,
{ owner, description, html_url, full_name }
) {
return withDetailsTemplate({
thumbnail: owner.avatar_url,
url: html_url,
description,
title: full_name
})
}
}
const pluginOptions = extend({}, defaultOptions, opts, {
_process
})
return base(pluginOptions)
}
resetOptions() {
return extend({}, this.options, {
_embeds: []
})
}
export default function basicVideo(opts) {
const defaultOptions = {
name,
regex: /(?:https?):\/\/\S*\.(?:ogv|webm|mp4)/gi,
template(args) {
return `<video class="ejs-video" controls="" src="${args[0]}"></video>`
}
}
const pluginOptions = extend({}, defaultOptions, opts)
return base(pluginOptions)
}