帮助程序将笔记管理为一个充满文件的目录。
dendron-notesdir的Python项目详细描述
关于
注意:这是一个https://pypi.org/project/notesdir/的分支,用于添加与树突相关的功能
Notesdir是一个命令行工具,可帮助您管理存储为常规文件的注释。 它可以帮助:
- 链接管理
- 移动文件时更新对文件的引用和对文件的引用
- 显示文件的链接和反向链接
- 元数据管理
- 通过适合文件类型的机制,在每个文件中存储标题、真实创建日期和标记
- 以统一格式显示元数据
- 查询
- 查找带有或不带有特定标记的文件
- 模板化
- 编写Mako模板以快速创建新便笺
- 组织
- 用Python编写基于文件元数据或文件间关系组织目录的规则
哲学
- 你可以使用任何你想要的编辑器。在
- 注释不一定都必须是相同的文件格式。 Notesdir目前可以解析和更新Markdown、HTML和pdf;新的文件类型支持很容易添加;无法识别的文件类型可以和平共处。在
- 你可以随意组织你的文件,也可以随意重组。在
- 没有notesdir,您的笔记应该完全可用。 特别是,注释之间的链接只是常规的相对文件路径,许多文本编辑器、终端和浏览器都可以遵循这些路径。在
- 您应该能够使用您想要的notesdir的功能。 我们的目标是更像一个库而不是一个框架。在
- Notesdir的功能很容易编程使用。 pythonapi可以导入到您自己的脚本中。 CLI命令还具有将输出打印为JSON的选项。在
设置
- 安装Python3.7或更高版本
- 运行
pip3 install notesdir
- 在主目录中创建.notesdir.conf.py文件:
fromnotesdir.confimport*conf=NotesdirConf(# SqliteRepo enables caching, which is important if you have more than a few dozen notes.# The sqlite database is just a cache: if you delete it, it'll be rebuilt the next time you# run notesdir (but that may take a while).repo_conf=SqliteRepoConf(# List the directories that contain your notes here.# These are searched recursively, you should not also list subdirectories.root_paths={'/Users/jacob/Zettel'},# Specify a path to store the cache in. The file will be created if it does not exist.# If you only have a handful of notes, you can use DirectRepoConf instead of SqliteRepoConf,# and omit this line.cache_path='/Users/jacob/local-only/notesdir-cache.sqlite3'),# This is an optional list of path globs where note templates can be found; it's used# by the `notesdir new` command.template_globs=["/Users/jacob/Zettel/*/templates/*.mako"])# This is optional. It determines the behavior of the `notesdir organize` command. This config sets# up a couple rules:# - If a file has title metadata, use that to set the filename, and use a limited set of characters# in the filename# - If you have attachments organized into ".resources" dirs - for example,# a file "foo.md" and "foo.md.resources/bar.png" - make sure the files in the resources dir move# when the main file moves.defpath_organizer(info):path=rewrite_name_using_title(info)returnresource_path_fn(path)orpathconf.path_organizer=path_organizer# This is optional. It tells notesdir not to parse or edit certain files. I store attachments# to notes in directories named like `filename.resources`, and those attachments would never# contain metadata or links that I want to query or update, so I skip parsing those.# These files can still be moved by `organize`, and backlinks are still tracked for them.defskip_parse(parentpath,filename):returnfilename.endswith('.resources')conf.repo_conf.skip_parse=skip_parse
就这样!
您可以运行notesdir query
来打印Notesdir当前知道的关于您的笔记的所有信息的列表。
(在您填写一些元数据之前,这可能是非常多的,也可能不是很多。)
第一次生成缓存时可能需要一段时间。在
请参阅full documentation了解所有功能的演练。在
- 项目
标签: