Skip to content

Commit

Permalink
fix invalid inline link URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
AprilSylph committed Nov 22, 2021
1 parent b55ce46 commit 108ea6e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lib/npf.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,9 @@ const formatRenderers = {
italic: () => document.createElement('em'),
strikethrough: () => document.createElement('s'),
small: () => document.createElement('small'),
link: ({ url }) => document.createElement('a').tap(a => {
a.href = url;
a.target = '_blank';
link: ({ url }) => Object.assign(document.createElement('a'), {
href: /^https?:\/\/.+/.test(url) ? url : `https://${url}`,
target: '_blank'
}),
mention: ({ blog: { url } }) => Object.assign(document.createElement('a'), {
href: /^https?:\/\/.+/.test(url) ? url : `https://${url}/`,
Expand Down

0 comments on commit 108ea6e

Please sign in to comment.