Skip to content

Commit 55ec428

Browse files
committed
TOC: properly detect Gist markdown files
1 parent 7f68a14 commit 55ec428

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

github-toc.user.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// ==UserScript==
22
// @name GitHub Table of Contents
3-
// @version 2.1.5
3+
// @version 2.1.6
44
// @description A userscript that adds a table of contents to readme & wiki pages
55
// @license MIT
66
// @author Rob Garrison
77
// @namespace https://github.com/Mottie
8-
// @include https://github.com/*
9-
// @include https://gist.github.com/*
8+
// @match https://github.com/*
9+
// @match https://gist.github.com/*
1010
// @run-at document-idle
1111
// @grant GM_registerMenuCommand
1212
// @grant GM.registerMenuCommand
@@ -35,6 +35,7 @@
3535
right: "10px", // popup right position when reset
3636
headerPad: "48px", // padding added to header when TOC is collapsed
3737
headerSelector: [".header", ".Header", ".header-logged-out > div"],
38+
wrapperSelector: "#wiki-body, #readme, [id^='file-'][id$='-md']",
3839
headerWrap: ".js-header-wrapper",
3940
toggle: "g+t", // keyboard toggle shortcut
4041
restore: "g+r", // keyboard reset popup position shortcut
@@ -267,7 +268,7 @@
267268
if (!tocInit) {
268269
return;
269270
}
270-
const wrapper = $("#wiki-body, #readme");
271+
const wrapper = $(defaults.wrapperSelector);
271272
if (wrapper) {
272273
let indx, header, anchor, txt;
273274
let content = "<ul>";

0 commit comments

Comments
 (0)