Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Luc Bourdot
codimd
Commits
558fa5fc
Commit
558fa5fc
authored
Oct 29, 2019
by
hoijui
Browse files
make standard conform [fix]
Signed-off-by:
hoijui
<
hoijui.quaero@gmail.com
>
parent
aaf94664
Changes
1
Hide whitespace changes
Inline
Side-by-side
public/js/extra.js
View file @
558fa5fc
...
...
@@ -860,7 +860,6 @@ const anchorForId = id => {
}
const
createHeaderId
=
(
headerContent
,
headerIds
=
null
)
=>
{
// to escape characters not allow in css and humanize
const
slug
=
slugifyWithUTF8
(
headerContent
)
let
id
...
...
@@ -873,13 +872,13 @@ const createHeaderId = (headerContent, headerIds = null) => {
// see GitHub implementation reference:
// https://gist.github.com/asabaylus/3071099#gistcomment-1593627
// it works like 'lower-case', but ...
const
id
_b
ase
=
slug
.
toLowerCase
()
id
=
id
_b
ase
const
id
B
ase
=
slug
.
toLowerCase
()
id
=
id
B
ase
if
(
headerIds
!==
null
)
{
// ... making sure the id is unique
let
i
=
1
while
(
headerIds
.
has
(
id
))
{
id
=
id
_b
ase
+
'
-
'
+
i
id
=
id
B
ase
+
'
-
'
+
i
i
++
}
headerIds
.
add
(
id
)
...
...
@@ -924,7 +923,6 @@ function getHeaderContent (header) {
}
function
changeHeaderId
(
$header
,
id
,
newId
)
{
$header
.
attr
(
'
id
'
,
newId
)
const
$headerLink
=
$header
.
find
(
`> a.anchor[href="#
${
id
}
"]`
)
$headerLink
.
attr
(
'
href
'
,
`#
${
newId
}
`
)
...
...
@@ -932,11 +930,10 @@ function changeHeaderId ($header, id, newId) {
}
export
function
deduplicatedHeaderId
(
view
)
{
// headers contained in the last change
const
headers
=
view
.
find
(
'
:header.raw
'
).
removeClass
(
'
raw
'
).
toArray
()
if
(
headers
.
length
==
0
)
{
return
;
if
(
headers
.
length
==
=
0
)
{
return
}
if
(
window
.
linkifyHeaderStyle
===
'
gfm
'
)
{
// consistent with GitHub, GitLab, Pandoc & co.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment