Skip to content

Commit 61baa84

Browse files
committed
Using existing element id as slug, if it exists
1 parent 8059c1e commit 61baa84

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/search.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function search(root, expression, maxDepth) {
4949
*/
5050

5151
visit(root, HEADING, function (child, index, parent) {
52-
var value = toString(child);
52+
var value = (child.data && child.data.hProperties) ? child.data.hProperties.id : toString(child);
5353
var id = slugs.slug(value);
5454

5555
if (parent !== root) {

0 commit comments

Comments
 (0)