This repository was archived by the owner on May 12, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import eventEmitter from 'browser/main/lib/eventEmitter'
1010import fs from 'fs'
1111import htmlTextHelper from 'browser/lib/htmlTextHelper'
1212import copy from 'copy-to-clipboard'
13+ import mdurl from 'mdurl'
1314
1415const { remote } = require ( 'electron' )
1516const { app } = remote
@@ -183,6 +184,14 @@ export default class MarkdownPreview extends React.Component {
183184 } )
184185 }
185186
187+ fixDecodedURI ( node ) {
188+ const { innerText, href } = node
189+
190+ node . innerText = mdurl . decode ( href ) === innerText
191+ ? href
192+ : innerText
193+ }
194+
186195 componentDidMount ( ) {
187196 this . refs . root . setAttribute ( 'sandbox' , 'allow-scripts' )
188197 this . refs . root . contentWindow . document . body . addEventListener ( 'contextmenu' , this . contextMenuHandler )
@@ -279,6 +288,7 @@ export default class MarkdownPreview extends React.Component {
279288 } )
280289
281290 _ . forEach ( this . refs . root . contentWindow . document . querySelectorAll ( 'a' ) , ( el ) => {
291+ this . fixDecodedURI ( el )
282292 el . addEventListener ( 'click' , this . anchorClickHandler )
283293 } )
284294
Original file line number Diff line number Diff line change 7070 "markdown-it-multimd-table" : " ^2.0.1" ,
7171 "markdown-it-named-headers" : " ^0.0.4" ,
7272 "md5" : " ^2.0.0" ,
73+ "mdurl" : " ^1.0.1" ,
7374 "mixpanel" : " ^0.4.1" ,
7475 "moment" : " ^2.10.3" ,
7576 "node-ipc" : " ^8.1.0" ,
You can’t perform that action at this time.
0 commit comments