Skip to content

Commit 558fa5f

Browse files
committed
make standard conform [fix]
Signed-off-by: hoijui <[email protected]>
1 parent aaf9466 commit 558fa5f

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

public/js/extra.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,6 @@ const anchorForId = id => {
860860
}
861861

862862
const createHeaderId = (headerContent, headerIds = null) => {
863-
864863
// to escape characters not allow in css and humanize
865864
const slug = slugifyWithUTF8(headerContent)
866865
let id
@@ -873,13 +872,13 @@ const createHeaderId = (headerContent, headerIds = null) => {
873872
// see GitHub implementation reference:
874873
// https://gist.github.com/asabaylus/3071099#gistcomment-1593627
875874
// it works like 'lower-case', but ...
876-
const id_base = slug.toLowerCase()
877-
id = id_base
875+
const idBase = slug.toLowerCase()
876+
id = idBase
878877
if (headerIds !== null) {
879878
// ... making sure the id is unique
880879
let i = 1
881880
while (headerIds.has(id)) {
882-
id = id_base + '-' + i
881+
id = idBase + '-' + i
883882
i++
884883
}
885884
headerIds.add(id)
@@ -924,19 +923,17 @@ function getHeaderContent (header) {
924923
}
925924

926925
function changeHeaderId ($header, id, newId) {
927-
928926
$header.attr('id', newId)
929927
const $headerLink = $header.find(`> a.anchor[href="#${id}"]`)
930928
$headerLink.attr('href', `#${newId}`)
931929
$headerLink.attr('title', newId)
932930
}
933931

934932
export function deduplicatedHeaderId (view) {
935-
936933
// headers contained in the last change
937934
const headers = view.find(':header.raw').removeClass('raw').toArray()
938-
if (headers.length == 0) {
939-
return;
935+
if (headers.length === 0) {
936+
return
940937
}
941938
if (window.linkifyHeaderStyle === 'gfm') {
942939
// consistent with GitHub, GitLab, Pandoc & co.

0 commit comments

Comments
 (0)