File tree Expand file tree Collapse file tree 5 files changed +10
-5
lines changed Expand file tree Collapse file tree 5 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -188,5 +188,6 @@ module.exports = {
188188 // 2nd appearance: "31-good-morning-my-friend---do-you-have-5-1"
189189 // 3rd appearance: "31-good-morning-my-friend---do-you-have-5-2"
190190 linkifyHeaderStyle : 'keep-case' ,
191- autoVersionCheck : true
191+ autoVersionCheck : true ,
192+ defaultTocDepth : 3
192193}
Original file line number Diff line number Diff line change @@ -147,5 +147,6 @@ module.exports = {
147147 openID : toBooleanConfig ( process . env . CMD_OPENID ) ,
148148 defaultUseHardbreak : toBooleanConfig ( process . env . CMD_DEFAULT_USE_HARD_BREAK ) ,
149149 linkifyHeaderStyle : process . env . CMD_LINKIFY_HEADER_STYLE ,
150- autoVersionCheck : toBooleanConfig ( process . env . CMD_AUTO_VERSION_CHECK )
150+ autoVersionCheck : toBooleanConfig ( process . env . CMD_AUTO_VERSION_CHECK ) ,
151+ defaultTocDepth : toIntegerConfig ( process . env . CMD_DEFAULT_TOC_DEPTH )
151152}
Original file line number Diff line number Diff line change @@ -41,7 +41,8 @@ exports.getConfig = (req, res) => {
4141 allowedUploadMimeTypes : config . allowedUploadMimeTypes ,
4242 defaultUseHardbreak : config . defaultUseHardbreak ,
4343 linkifyHeaderStyle : config . linkifyHeaderStyle ,
44- useCDN : config . useCDN
44+ useCDN : config . useCDN ,
45+ defaultTocDepth : config . defaultTocDepth
4546 }
4647 res . set ( {
4748 'Cache-Control' : 'private' , // only cache by client
Original file line number Diff line number Diff line change @@ -813,7 +813,7 @@ export function generateToc (id) {
813813 /* eslint-disable no-unused-vars */
814814
815815 var tocOptions = md . meta . toc || { }
816- var maxLevel = ( typeof tocOptions . maxLevel === 'number' && tocOptions . maxLevel > 0 ) ? tocOptions . maxLevel : 3
816+ var maxLevel = ( typeof tocOptions . maxLevel === 'number' && tocOptions . maxLevel > 0 ) ? tocOptions . maxLevel : window . defaultTocDepth
817817
818818 var toc = new window . Toc ( 'doc' , {
819819 level : maxLevel ,
@@ -1016,7 +1016,7 @@ export function renderTOC (view) {
10161016 /* eslint-disable no-unused-vars */
10171017
10181018 var tocOptions = md . meta . toc || { }
1019- var maxLevel = ( typeof tocOptions . maxLevel === 'number' && tocOptions . maxLevel > 0 ) ? tocOptions . maxLevel : 3
1019+ var maxLevel = ( typeof tocOptions . maxLevel === 'number' && tocOptions . maxLevel > 0 ) ? tocOptions . maxLevel : window . defaultTocDepth
10201020
10211021 const TOC = new window . Toc ( 'doc' , {
10221022 level : maxLevel ,
Original file line number Diff line number Diff line change @@ -13,3 +13,5 @@ window.linkifyHeaderStyle = '<%- linkifyHeaderStyle %>'
1313window.DROPBOX_APP_KEY = '<% - DROPBOX_APP_KEY %> '
1414
1515window.USE_CDN = <% - useCDN %>
16+
17+ window.defaultTocDepth = <% - defaultTocDepth %>
You can’t perform that action at this time.
0 commit comments