🎉 欢迎访问GreasyFork.Org 镜像站!本镜像站由公众号【爱吃馍】搭建,用于分享脚本。联系邮箱📮

Greasy fork 爱吃馍镜像

Greasy Fork is available in English.

📂 缓存分发状态(共享加速已生效)
🕒 页面同步时间:2026/01/02 19:29:38
🔄 下次更新时间:2026/01/02 20:29:38
手动刷新缓存

GithHub Toc

Generate TOC(Table of Content) for Github readme and Github Wiki

06.10.2014 itibariyledir. En son verisyonu görün.

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

// ==UserScript==
// @name        GithHub Toc
// @description Generate TOC(Table of Content) for Github readme and Github Wiki
// @author      wenLiangcan
// @version     0.1
// @namespace   https://github.com/wenLiangcan
// @homepage    https://github.com/summerblue/github-toc
// @license     MIT (http://mit-license.org/)
// @copyright   Copyright © 2014 wenLiangcan
// @updateURL
// @downloadURL
// @include     https://github.com/*
// @include     http://github.com/*
// @run-at      document-end
// @require     http://code.jquery.com/jquery-2.1.1.min.js
// @require     https://raw.github.com/jgallen23/toc/master/dist/toc.min.js
// @grant       GM_addStyle
// ==/UserScript==


GM_addStyle("#toc{margin-bottom:25px}#toc ul{margin:0;padding:0;list-style:disc;margin-left:15px}#toc li a{padding:5px 10px}#toc a{text-decoration:none;display:block}#toc a:hover{background:#F3F4F8}#toc .toc-h1{padding-left:0}#toc .toc-h2{padding-left:0}#toc .toc-h3{padding-left:10px;list-style:none}article.markdown-body h2,#wiki-body .markdown-body h2{padding-bottom:.3em;font-size:1.5em;line-height:1.225;border-bottom:2px solid #eee}article.markdown-body h3,#wiki-body .markdown-body h3{padding-bottom:.3em;font-size:1.3em;line-height:1.225;border-bottom:1px solid #eee}");

(function($) {
    $('#wiki-body .markdown-body').prepend("<div id='toc'><div>");
    $('#wiki-body .markdown-body').addClass('toc-mian-body')
    $('article.markdown-body').prepend("<div id='toc'><div>");
    $('article.markdown-body').addClass('toc-mian-body')
    $('#toc').toc({
        'selectors': 'h1,h2,h3', //elements to use as headings
        'container': '.markdown-body.toc-mian-body', //element to find all selectors in
        'smoothScrolling': true, //enable or disable smooth scrolling on click
        'prefix': 'toc', //prefix for anchor tags and class names
        'onHighlight': function(el) {}, //called when a new section is highlighted
        'highlightOnScroll': true, //add class to heading that is currently in focus
        'highlightOffset': 100, //offset to trigger the next headline
        'anchorName': function(i, heading, prefix) { //custom function for anchor name
            return prefix + i;
        },
        'headerText': function(i, heading, $heading) { //custom function building the header-item text
            var rank = $heading.prop("tagName").substr(1)
            if (rank > 2) {
                return '- ' + $heading.text();
            }
            return $heading.text();
        },
    });
    $('.markdown-body.toc-mian-body').prepend("<h2>Table of Contents</h2>");
})(jQuery);