管理员和编辑者指南

BookStack 黑魔法

这是由系统管理员维护的,针对 BookStack 适应 BYRWIKI 需求所做的魔改备忘。

请在每次进行魔改操作之后更新本条目。

代码说明

BookStack WIKI 系统需求列表

自定义 HTML 头部内容

<style>
    html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
        font-family: "Hiragino Sans GB W3", "Hiragino Sans GB", "Microsoft YaHei", "Droid Sans Fallback", "Source Sans", "Wenquanyi Micro Hei", "WenQuanYi Micro Hei Mono", "WenQuanYi Zen Hei", "WenQuanYi Zen Hei", "Apple LiGothic Medium", "SimHei", "ST Heiti", "WenQuanYi Zen Hei Sharp", sans-serif;
    }
    #byriosc-index-content h1 {
        display: none;
    }
    #byriosc-index-content h2 {
        margin-top: 0.4629531414em;
    }
    .page-content blockquote p:first-of-type {
        text-indent: 2em;
    }
</style>

<script>
    window.addEventListener('load', () => {
         document.querySelectorAll(".book-tree p.text-muted").forEach((e) => e.remove()); 
         document.querySelectorAll(".page-list p.text-muted").forEach((e) => e.remove()); 
         document.querySelectorAll(".inset-list").forEach((e) => e.style["display"] = "block");
}, false)
</script>

<script>
    if (window.location.pathname == "/") {
        window.addEventListener('load', () => {
            fetch('/books/wiki-%E6%8C%87%E5%8D%97/page/%E6%AC%A2%E8%BF%8E')
                .then((r) => r.text())
                .then((rt) => {
                    a = document.createElement('div');
                    a.innerHTML = `<div class="row" style="padding: 0 16px; font-size: 14px;">
                        <div id="byriosc-index-card" class="card">
                            <h3>
                                <svg class="svg-icon" data-icon="file" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
                                    <path d="M6 2c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6H6zm7 7V3.5L18.5 9H13z"></path>
                                    <path d="M0 0h24v24H0z" fill="none"></path>
                                </svg>
                                欢迎
                            </h3>
                            <div id="byriosc-index-content" style="padding: 32px" class="row"></div>
                        </div>
                    </div>`;
                    r = document.querySelectorAll("#content .container .row")[0];
                    r.parentNode.insertBefore(a, r);
                    a = document.createElement('div');
                    a.innerHTML = rt;
                    rt = a.querySelector("div.page-content").innerHTML;
                    console.log(rt);
                    rt = rt.replace(/(<h2 id=".*">)/g, '</div><div class="col-sm-4">$1');
                    rt = rt.replace(/(<h4 id=".*">)/g, '</div><div class="col-sm-4">$1');
                    rt = rt.replace(/<\/div><div class="col-sm-4">/, '<div class="col-sm-4">');
                    rt += '</div>';
                    document.getElementById("byriosc-index-content").innerHTML = rt;
                });
        })
    }
</script>