Giter VIP home page Giter VIP logo

Comments (5)

Sleepleeps avatar Sleepleeps commented on August 18, 2024

我想了一下,有一个比较简单的方法,你可以在正文前加上目录。
image

如果你不喜欢目录的方法,还是想在正文实现,等我这两天稍微修改一下原文代码。

普通目录效果如下
image

因为作者的“空白章节”的设置是放在chapterHighlights数组进行判断的,所以只要打开开关后,在代码开头加上以下代码即可。

{% for highlightItem in chapterHighlights -%}
{{ highlightItem.chapterTitle }}<br>
{%- endfor %}

如果希望目录还有跳转笔记的功能,只要改成

{% for highlightItem in chapterHighlights -%}
[{{ highlightItem.chapterTitle }}](#{{ highlightItem.chapterTitle | replace(' ', '&') }})<br>
{%- endfor %}

跳转

from template-for-obsidian-weread-plugin.

qwepuorytgj avatar qwepuorytgj commented on August 18, 2024

啊,太感谢了!谢谢~!
不急,等您有空的时候帮忙看着改下就行的
WX20240301-094937@2x
主要想实现的其实是这种效果:在目录栏,可以同时看到所有目录(包括没有高亮的)
【原因】这样对于全书的内容可以有一个概览,同时当我需要看某一章节的高亮或划线时,通过目录点过去就可以
再次感谢,期待

from template-for-obsidian-weread-plugin.

qwepuorytgj avatar qwepuorytgj commented on August 18, 2024

所以确实是想在正文中实现的
类似:

元数据
本书评论

# 笔记
## 章节标题
###### 高亮

## 章节标题(没划线没高亮)

## 章节标题
###### 笔记/划线批注

from template-for-obsidian-weread-plugin.

Sleepleeps avatar Sleepleeps commented on August 18, 2024

我试了一下,打开空白章节开关后,你把代码开头改成这样就行


{%- set allNotes = [] -%}

{%- for highlightItem in chapterHighlights -%}
{%- if  highlightItem.highlights.length>0 -%} 
{%- for highlight in highlightItem.highlights -%} 
{%- set allNotes = allNotes.concat({'type': 'highlight', 'data': highlight, 'range': highlight.range.split("-")[0] | int}) -%}
{%- endfor -%}
{%- else -%} 
{%- set allNotes = allNotes.concat({'type': '0', 'data': highlightItem, 'range': '0' }) -%}
{%- endif -%}
{%- endfor -%}

from template-for-obsidian-weread-plugin.

qwepuorytgj avatar qwepuorytgj commented on August 18, 2024

可以了~!可以了~!
太感谢了~!
真的非常感谢~!

from template-for-obsidian-weread-plugin.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.