dillonzq / LoveIt

❤️A clean, elegant but advanced blog theme for Hugo 一个简洁、优雅且高效的 Hugo 主题
https://hugoloveit.com
MIT License
3.37k stars 1.07k forks source link

[BUG] right TOC problem #695

Closed loulazynote closed 2 years ago

loulazynote commented 2 years ago

Describe the bug 描述你遇到的错误

A clear and concise description of what the bug is. 一段简短的对于你遇到的错误的描述.

右側TOC往下捲動後會出現此Error,且右側TOC並沒有正確關聯到中間的Content 捲動到一半 右側TOC就消失了

Expected behavior 期待的行为

A clear and concise description of what you expected to happen. 一段简短的对于你期待的行为的描述.

右側TOC應準確與中間Content的 h1~3 正確關聯

Screenshots 屏幕截图

If applicable, add screenshots to help explain your problem. 如果可以的话, 提供屏幕截图对解决问题很有帮助.

image

Build Environment 构建环境

Please try to use Hugo extended version before opening the issue. 请在创建 issue 之前尝试使用 Hugo extended 版本.

Preview Environment 预览环境

Additional Information 补充信息

Configuration files or front matter code... 配置文件或者前置参数的代码...

# config.toml
# determines default content language ["en", "zh-tw", "fr", "pl", ...]
defaultContentLanguage = "zh-tw"

baseURL = 'https://loulazynote.github.io/'

theme = "LoveIt"

title = ""
# googleAnalytics = ''
enableEmoji = true
hasCJKLanguage = true
languageCode = 'zh-TW'
languageName = "繁體中文"
picture = "/images/logo.png"
# Enable for syntax highlighting
pygmentsCodeFences = true
pygmentsUseClasses = true
# pygmentsStyle = "dracula"

# author config
[author]
email = ""
link = ""
name = ""
picture = "/images/logo.png"

# menu config
[menu]
[[menu.main]]
identifier = "posts"
weight = 1
pre = "<i class='fa-solid fa-pen-to-square'></i>"
name = "Posts"
post = ""
url = "/posts/"
# title will be shown when you hover on this menu link
title = ""
[[menu.main]]
identifier = "tags"
name = "Tags"
post = ""
pre = "<i class='fa-solid fa-hashtag'></i>"
title = ""
url = "/tags/"
weight = 2
[[menu.main]]
identifier = "categories"
name = "Categories"
post = ""
pre = "<i class='fa-solid fa-book-bookmark'></i>"
title = ""
url = "/categories/"
weight = 3

[params]
# site default theme ["auto", "light", "dark"]
defaultTheme = "auto"
# public git repo url only then enableGitInfo is true
gitRepo = ""
# which hash function used for SRI, when empty, no SRI is used
# ["sha256", "sha384", "sha512", "md5"]
fingerprint = ""
# date format
dateFormat = "2006-01-02"
# website title for Open Graph and Twitter Cards
title = ""
# website description for RSS, SEO, Open Graph and Twitter Cards
description = ""
# website images for Open Graph and Twitter Cards
customCSS = ["syntax.css"]
images = ["/images/logo.png"]
useCustomChroma = true
# Header config
[params.header]
# desktop header mode ["fixed", "normal", "auto"]
desktopMode = "fixed"
# mobile header mode ["fixed", "normal", "auto"]
mobileMode = "auto"
# Header title config
[params.header.title]
# URL of the LOGO
logo = ""
# title name
name = ""
# you can add extra information before the name (HTML format is supported), such as icons
pre = "<i class=\"fa-solid fa-house\"></i> "
# you can add extra information after the name (HTML format is supported), such as icons
post = ""
# whether to use typeit animation for title name
typeit = false

# Footer config
[params.footer]
enable = true
# Custom content (HTML format is supported)
custom = ""
# whether to show Hugo and theme info
hugo = false
# whether to show copyright info
copyright = false
# whether to show the author
author = false
# Site creation time
since = 2022
# ICP info only in China (HTML format is supported)
icp = ""
# license info (HTML format is supported)
license = ''

# Section (all posts) page config
[params.section]
# special amount of posts in each section page
paginate = 20
# date format (month and day)
dateFormat = "01-02"
# amount of RSS pages
rss = 10

# List (category or tag) page config
[params.list]
# special amount of posts in each list page
paginate = 20
# date format (month and day)
dateFormat = "01-02"
# amount of RSS pages
rss = 10

# App icon config
[params.app]
# optional site title override for the app when added to an iOS home screen or Android launcher
title = ""
# whether to omit favicon resource links
noFavicon = false
# modern SVG favicon to use in place of older style .png and .ico files
svgFavicon = "/images/favicon.ico"
# Android browser theme color
themeColor = "#ffffff"
# Safari mask icon color
iconColor = "#5bbad5"
# Windows v8-10 tile color
tileColor = "#da532c"

# Search config
[params.search]
enable = true
# type of search engine ["lunr", "algolia"]
type = "algolia"
# max index length of the chunked content
contentLength = 4000
# placeholder of the search bar
placeholder = ""
# max number of results length
maxResultLength = 10
# snippet length of the result
snippetLength = 30
# HTML tag name of the highlight part in results
highlightTag = "em"
# whether to use the absolute URL based on the baseURL in search index
absoluteURL = true
[params.search.algolia]
appID = ""
index = ""
searchKey = ""

# Home page config
[params.home]
# amount of RSS pages
rss = 10
# Home page profile
[params.home.profile]
enable = true
# Gravatar Email for preferred avatar in home page
gravatarEmail = ""
# URL of avatar shown in home page
avatarURL = "/images/logo.png"
# title shown in home page (HTML format is supported)
title = ""
# subtitle shown in home page (HTML format is supported)
subtitle = ""
# whether to use typeit animation for subtitle
typeit = true
# whether to show social links
social = true
# disclaimer (HTML format is supported)
disclaimer = ""
# Home page posts
[params.home.posts]
enable = true
# special amount of posts in each home posts page
paginate = 6
# replaced with hiddenFromHomePage in params.page
# default behavior when you don't set "hiddenFromHomePage" in front matter
defaultHiddenFromHomePage = false

# Social config about the author
[params.social]
Facebook = ""
GitHub = ""
Instagram = ""
RSS = true
Twitter = ""

[params.page]
# whether to hide a page from home page
hiddenFromHomePage = false
# whether to hide a page from search results
hiddenFromSearch = false
# whether to enable twemoji
twemoji = false
# whether to enable lightgallery
lightgallery = false
# whether to enable the ruby extended syntax
ruby = false
# whether to enable the fraction extended syntax
fraction = false
# whether to enable the fontawesome extended syntax
fontawesome = true
# whether to show link to Raw Markdown content of the content
linkToMarkdown = true
# whether to show the full text content in RSS
rssFullText = false
[params.page.toc]
# whether to enable the table of the contents
enable = true
# whether to keep the static table of the contents in front of the post
keepStatic = false
# whether to make the table of the contents in the sidebar automatically collapsed
auto = true
# KaTeX mathematical formulas
[params.page.math]
enable = true
# default inline delimiter is $ ... $ and \( ... \)
inlineLeftDelimiter = ""
inlineRightDelimiter = ""
# default block delimiter is $$ ... $$, \[ ... \], \begin{equation} ... \end{equation} and some other functions
blockLeftDelimiter = ""
blockRightDelimiter = ""
# KaTeX extension copy_tex
copyTex = true
# KaTeX extension mhchem
mhchem = true

# Code config
[params.page.code]
# whether to show the copy button of the code block
copy = true
# the maximum number of lines of displayed code by default
maxShownLines = 50

# social share links in post page
[params.page.share]
Facebook = true
HackerNews = false
Line = true
Reddit = false
Twitter = true
Weibo = false
baidu = false
enable = true
# Comment config
[params.page.comment]
enable = true
# Disqus comment config
[params.page.comment.disqus]
enable = true
# Disqus shortname to use Disqus in posts
shortname = ""
# Telegram Comments
[params.page.comment.telegram]
color = ""
colorful = true
dislikes = false
enable = false
height = ""
limit = 5
outlined = false
siteID = ""
# Facebook comment config
[params.page.comment.facebook]
appId = ""
enable = false
numPosts = 10
width = "100%"
# automatically adapt the current theme i18n configuration when empty
languageCode = "zh-TW"
# Third-party library config
[params.page.library]
[params.page.library.css]
# someCSS = "some.css"
# located in "assets/"
# Or
# someCSS = "https://cdn.example.com/some.css"
[params.page.library.js]
# someJavascript = "some.js"
# located in "assets/"
# Or
# someJavascript = "https://cdn.example.com/some.js"
# Page SEO config
[params.page.seo]
# image URL
images = []
# Publisher info
[params.page.seo.publisher]
logoUrl = "/images/logo.png"
name = ""

# TypeIt
[params.typeit]
speed = 200
cursorSpeed = 1000
cursorChar = "&block;"
duration = -1

[params.analytics]
enable = true
[params.analytics.google]
id = ""
anonymizeIP = true

[outputs]
home = ["HTML", "RSS", "JSON"]

[outputFormats.Algolia]
baseName = "algolia"
isPlainText = true
mediaType = "application/json"
notAlternative = true

[taxonomies]
category = 'categories'
tag = 'tags'

[markup]
defaultMarkdownHandler = 'goldmark'
[markup.asciidocExt]
backend = 'html5'
extensions = []
failureLevel = 'fatal'
noHeaderOrFooter = true
preserveTOC = false
safeMode = 'unsafe'
sectionNumbers = false
trace = false
verbose = false
workingFolderCurrent = false
[markup.asciidocExt.attributes]
[markup.goldmark]
[markup.goldmark.extensions]
definitionList = true
footnote = true
linkify = true
linkifyProtocol = 'https'
strikethrough = true
table = true
taskList = true
typographer = true
[markup.goldmark.parser]
autoHeadingID = true
autoHeadingIDType = 'github'
[markup.goldmark.parser.attribute]
block = false
title = true
[markup.goldmark.renderer]
hardWraps = false
unsafe = false
xhtml = false
# Syntax Highlighting (https://gohugo.io/content-management/syntax-highlighting)
[markup.highlight]
# false is a necessary configuration (https://github.com/dillonzq/LoveIt/issues/158)
anchorLineNos = false
codeFences = true
guessSyntax = false
lineNoStart = 1
lineNos = true
lineNumbersInTable = true
noClasses = false
noHl = false
style = "dracula"
tabWidth = 4
[markup.tableOfContents]
endLevel = 3
ordered = false
startLevel = 1
loulazynote commented 2 years ago

Sor, I found the Solution