Skip to content

prettynb/pnbp

Repository files navigation

pnbp = "pretty notebook parser"


pnbp provides programmatic access to a notebook via :

  • > pnbp/pnbp : models and methods.
    • access notes and their individual (regex established) components in the python repl, scripts, and your own shell commands.
  • > pnbp/commands : shell commands.
    • run pre-defined function against a notebook in the terminal directly, or, scheduled.

---

a pretty notebook is the collection of markdown files in a specific directory. a pretty note is a single .md file within the notebook directory.

links ( [[link]] , ![[link.jpg]] ), tags ( #tag ), codeblocks ( ```py print("Hello World")``` ), and urls ( [goog](https://google.com) ) are the main components outside of additional render syntax of a .md note using an extended linking and tagging markdown.

https://obsidian.md/ is the best example of this in action.


quickstart guide :


(0) -> pip install pnbp

(-1) -> git clone the repo.
pip uninstall pnbp
git clone https://github.com/prettynb/pnbp/ pnbp
cd pnbp/
pip install -r requirements.txt
pip install --editable .

(2) -> set environment variables.
var desc e.g.
NOTE_PATH the full directory path of your notebook echo 'export NOTE_PATH="/users/alice/notebook"' >> ~/.zshrc
IMG_PATH (optional entirely; set here or in pnbp_conf.json) echo 'export IMG_PATH="$NOTE_PATH/imgs"' >> ~/.zshrc
HTML_PATH (optional entirely; useful debug w/ pnbp-blog; set here, in pnbp_conf.json, or not at all.) echo 'export HTML_PATH="$NOTE_PATH/html"' >> ~/.zshrc
NOTE_NESTED (optional; default="flat") => "single", "recurs", "all", ...
NOTE_CONFIG (optional) => "off" to ignore using a NOTE_PATH/pnbp_conf.json echo 'export NOTE_CONFIG="off"' >> ~/.zshrc

NOTE_NESTED

  • "flat" - by default, pnbp assumes that every .md note exist within the base directory level of NOTE_PATH/.
  • "single" - if you want pnbp to search for .md notes within additional (non-hidden) directory level up.
  • "recurs" - if you want .md notes to be found through all (non-hidden) directory levels up.
  • "all" - if you want even hidden (non- .git, .obsidian) directories traversed recursively up.

NOTE_CONFIG

  • without NOTE_CONFIG="off", "NOTE_PATH/pnbp_conf.json" will be nagged for.
  • Notebook can generate one at the python prompt that you can edit later ->

( ... on Windows? Environment Variable(s) can be set here. Also, recall that in most places you'll also need to escape the "\" within any path strings (e.g. "IMG_PATH": "\\Users\\alice\\notebook\\imgs") used; the drive letter (e.g. "D:\\Media\imgs") is optional if it's your %HOMEDRIVE%. )


(3) -> access your notes in python3.9 !
>>> import pnbp
>>> nb = pnbp.Notebook()
... 

About

pretty notebook parser

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages