中文 | English
Obsidian user script to collect same section in notes into one view. e.g. collect ideas or thoughts section in daily notes.
There 2 ways to use scripts in this project.
- use the one in
Scripts/custom
directory with CustomJS plugin of Obsidian. - use the one in
Views/custom
directory withdv.view()
method of Obsidian DataView plugin.
Steps:
-
find, install and enable
DataView
andCustomJS
plugins inCommunity Plugins
page of settings. -
in the CustomJS plugin's settings page, set
Folder
toScripts/custom
. -
make the
Scripts/custom
directory in your vault, if not exist.cd <VAULT-DIRECTORY> mkdir -p Scripts/custom
-
get
Scripts/custom/SectionCollector.js
and put it intoScripts/custom
directory in the vault.- clone this repository and copy file
- browse and save raw content of the script in browser
- get tar ball from release page and extract the file
-
make the
Views
directory in your vault, if not exist.cd <VAULT-DIRECTORY> mkdir Views
-
create the view note that you want in
Views
directory, e.g. Ideas.md, and put the code blow in it:```dataviewjs let SECTION_NAME = "Ideas"; let TAG_NAME = "ideas"; const {SectionCollector} = customJS; SectionCollector.show(app, dv, SECTION_NAME, TAG_NAME); ```
NOTICE: actually, in this way to use the script, you can put the view note anywhere.
-
add
Ideas
section and#ideas
tag in any notes that you want to put your ideas like this:#ideas ## Ideas 1. make it possible to collect same sections in all notes into one view 2. ...
-
open the view note
Views/Ideas
, you will see all the ideas are collected into it.
Steps:
-
find, install and enable
DataView
plugins inCommunity Plugins
page of settings. -
make the
Views/custom
directory in your vault, if not exist.cd <VAULT-DIRECTORY> mkdir -p Views/custom
NOTICE: you can change the directory path as you like, and specify it in the following step 4
-
get
Views/custom/SectionCollector.js
and put it intoViews/custom
directory in the vault.- clone this repository and copy file
- browse and save raw content of the script in browser
- get tar ball from release page and extract the file
-
create the view note that you want in
Views
directory, e.g. Ideas.md, and put the code blow in it:```dataviewjs const options = { app: app, section_name: "Ideas", tag_name: "ideas", }; await dv.view("Views/custom/SectionCollector", options); ```
NOTICE: actually, in this way to use the script, you can put the view note anywhere.
-
add
Ideas
section and#ideas
tag in any notes that you want to put your ideas like this:#ideas ## Ideas 1. make it possible to collect same sections in all notes into one view 2. ...
-
open the view note
Views/Ideas
, you will see all the ideas are collected into it.
you can see the sample note Views/Ideas.md
as reference
if you insert images in the vault local directory into your note, make sure the path is full related path. e.g. if you put images in images
directory, the image link should be like this:
![[images/section-collector.png]]
Or
![](images/section-collector.png)
Hope this script is useful to you :)