Skip to content

Commit d60fb7d

Browse files
authored
Merge pull request #991 from anikethsaha/develop
chore: removed the escaping of the name of sidebar
2 parents 5b77b0f + 7d0c164 commit d60fb7d

File tree

2 files changed

+11
-27
lines changed

2 files changed

+11
-27
lines changed

src/core/render/tpl.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import {isMobile} from '../util/env'
2-
import {escapeString} from '../util/core'
1+
import { isMobile } from '../util/env'
32
/**
43
* Render github corner
54
* @param {Object} data
@@ -9,11 +8,13 @@ export function corner(data, cornerExternalLinkTarge) {
98
if (!data) {
109
return ''
1110
}
11+
1212
if (!/\/\//.test(data)) {
1313
data = 'https://github.com/' + data
1414
}
15+
1516
data = data.replace(/^git\+/, '')
16-
// double check
17+
// Double check
1718
cornerExternalLinkTarge = cornerExternalLinkTarge || '_blank'
1819

1920
return (
@@ -31,8 +32,7 @@ export function corner(data, cornerExternalLinkTarge) {
3132
* Render main content
3233
*/
3334
export function main(config) {
34-
35-
const name = config.name? escapeString(config.name):''
35+
const name = config.name ? config.name : ''
3636

3737
const aside =
3838
'<button class="sidebar-toggle" aria-label="Menu">' +
@@ -41,13 +41,11 @@ export function main(config) {
4141
'</div>' +
4242
'</button>' +
4343
'<aside class="sidebar">' +
44-
(config.name ?
45-
`<h1 class="app-name"><a class="app-name-link" data-nosearch>${
46-
config.logo ?
47-
`<img alt="${name}" src=${config.logo}>` :
48-
name
49-
}</a></h1>` :
50-
'') +
44+
(config.name
45+
? `<h1 class="app-name"><a class="app-name-link" data-nosearch>${
46+
config.logo ? `<img alt="${name}" src=${config.logo}>` : name
47+
}</a></h1>`
48+
: '') +
5149
'<div class="sidebar-nav"><!--sidebar--></div>' +
5250
'</aside>'
5351

@@ -88,6 +86,7 @@ export function tree(toc, tpl = '<ul class="app-sub-sidebar">{inner}</ul>') {
8886
if (!toc || !toc.length) {
8987
return ''
9088
}
89+
9190
let innerHTML = ''
9291
toc.forEach(node => {
9392
innerHTML += `<li><a class="section-link" href="${node.slug}">${node.title}</a></li>`

src/core/util/core.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,3 @@ export function isFn(obj) {
5757
return typeof obj === 'function'
5858
}
5959

60-
/**
61-
* escape String
62-
*/
63-
export function escapeString(string) {
64-
const entityMap = {
65-
'&': '&amp;',
66-
'<': '&lt;',
67-
'>': '&gt;',
68-
'"': '&quot;',
69-
'\'': '&#39;',
70-
'/': '&#x2F;'
71-
}
72-
73-
return String(string).replace(/[&<>"'/]/g, s => entityMap[s])
74-
}

0 commit comments

Comments
 (0)