Commit b70f09f5 authored by lambdacastix's avatar lambdacastix
Browse files

[feat] first implementation of #55: use noreferrer

parent c510541c
......@@ -8,9 +8,19 @@ export default ({ app, store }) => {
// not where in the worlds I'm looking at the page from
moment.tz.setDefault(store.state.settings.instance_timezone)
let a_template = '<a target="_blank" rel="noreferrer noopener nofollow" href="'
// replace links with anchors
// TODO: remove fb tracking id
Vue.filter('linkify', value => value.replace(/(https?:\/\/([^\s]+))/g, '<a href="$1">$2</a>'))
Vue.filter('linkify', value => value.replace(
// step1: markdown links
/\[([^\]]+)(\]\()(https?:\/\/[^\s]+)(\))/g,
a_template + '$3">$1</a>'
).replace(
// step2: just the link
// DEBUG: excludes "< so it's not already replaced by step1
/([^"<])(https?:\/\/[^\s)\]}"']+)/g,
a_template + '$2">$2</a>'
))
Vue.filter('url2host', url => url.match(/^https?:\/\/(.[^/:]+)/i)[1])
Vue.filter('datetime', value => moment(value).locale(store.state.locale).format('ddd, D MMMM HH:mm'))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment