parse logseq markdown text with easy access to properties, hierarchy, TODO etc
Project description
LogseqMarkdownParser
a simple python script to load a markdown file and easily access the properties of each block etc.
Why?
- I wanted a script that reads a logseq page, extracts every "DONE" tasks and append it to another file. So I made this little parser. The resulting script can be found in
examples/done_mover.py
. If you need anything just create an issue.
Features
- access block properties as a dictionary
- get the parent uuid of each block as well as its position in the hierarchy (i.e. which header is above)
- get the indentation of each block
- easily save to a path
Usage
- Install python -m pip install LogseqMarkdownParser
- load file parsed_text = LogseqMarkdownParser.parse_file(file_content).parse_text(verbose=True)
- get information about a block print(parsed_text.parsed_blocks[0]) print(parsed_text.parsed_blocks[0].block_properties)
- add a property to a block (a del_logseq_property method also exists) parsed_text.parsed_blocks[0].add_logseq_property(key, value)
- save to path parsed_text.save_as(other_file_path)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
LogseqMarkdownParser-0.2.tar.gz
(41.7 kB
view hashes)
Built Distribution
Close
Hashes for LogseqMarkdownParser-0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 268d83169e8017ca61c64574428c6a7e6a6e6bbd3cb8cd8560829b7fc5267c4e |
|
MD5 | 6c5b3d5fcf8da05e22321eeddfce9ca1 |
|
BLAKE2b-256 | 807ac0e1bcddcb59a930b6791b1a61577e54a596804f18dd1671636418a30619 |