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.
Notes to reader
- Why make this? 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. - How stable is it? Probably not very, I use it for specific things so things might go south. Please open an issue if you found a bug.
- note that the github version might be more up to date than the PyPI version
- Does it take into account the logbook (i.e. what's added to the block when clicking on 'DOING')? I didn't think about that initially. I think it should be parsed as normal block content and not as a property.
Features
- access block properties as a dictionary
- easily save to a path
Usage
- Install with
python -m pip install LogseqMarkdownParser
- load file with
parsed = LogseqMarkdownParser.parse_file(file_content, verbose=True)
- get the first block with
parsed.blocks[0]
- get its properties with
parsed.blocks[0].get_properties()
- add a property to a block with
parsed.blocks[0].set_property(key, value)
- save to path with
parsed.export_to("some/path.md")
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.9.tar.gz
(43.5 kB
view hashes)
Built Distribution
Close
Hashes for LogseqMarkdownParser-0.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d88a012fc58f747a711f98c8be50dbff329648ff3e5a7b50f33da8e92dd5b4a |
|
MD5 | 6aef2d1baa2a3d975e274e603c39d85d |
|
BLAKE2b-256 | e026bcfaf7c6fe468d50636162bdf6bd081d40b91e01b04c9e9155f7a91eb6be |