Package: cson-to-markdown
Cson To MarkdownWhatRecursively scans given folder for.csonfiles, extracts the metadata and markdown,
and writes a.mdfile and ameta/.ymlfile.
Written specifically for use withBoostnote.Why?I write everything in Markdown format because I like the formatting, and my favourite markdown editor so far is Boostnote.
Everything is stored in a dedicated git repository and pushed whenever changes occur.
This works great!The problemthough, is that Boostnote stores the file in acsonformat, without subfolders  and without legible note-titles.
I wrote something that extracts this information without disturbing the original files, and writes both the markdown and the metadata somewhere else.
They're created in the subfolder to which they belong in the application, with the note title as filename.Caution:A new version is in the works and will be announced which might completely break this tool.How to installpip install cson-to-markdownHow to use1. CLII use Google'spython-fireto create the CLI.
You can runcson_to_markdown --helpto get more information on the module.There's 3 arguments that can be provided;cson_to_markdown $arg1 $arg2 $arg3The folder with the.csonfiles that need to be converted (looks recursive  in this path for all compatible files).Optionaltarget folder for markdown file output. If no value is provided, they will be stored in the same folder as the.csonfiles.Optionalfolder containing theboostnote.jsonfile. This contains the key-name pairs of the folders defined in the Boostnote aplication itself.# Call module directlycson_to_markdown~/folder/with/notes~/output/folder~/settings/dir# Through pythonpython-mcson_to_markdown~/folder/with/notes~/output/folder~/settings/dir2. Python:fromcson_to_markdownimportFileConverterconverter=FileConverter("folder/with/cson","optional/target/folder","optional/boostnote/settings/dir")converter.convert()3. Git hooksYou can leverage the usefulness of git hooks, to make use of this module.
Based off ofthis StackOverflow answer, I implemented the following:Note:This is not a clean way to do this, think before you copy paste this.Create pre-commit hook in notes repository:vim .git/hooks/pre-commit#!/bin/bashechotouch.commitexitCreate post-commit hook to create and add new files to the commit:vim .git/hooks/post-commit#!/bin/bashcson_to_markdown$INSERT_NOTES_FOLDER$OPTIONAL_MARKDOWN_OUTPUT_FOLDER$OPTIONAL_BOOSTNOTE_SETTINGS_FOLDERif[-a.commit]thenrm.commitgitadd.gitcommit--amend-CHEAD--no-verifyfiexitMake both executable:chmod u+x .git/hooks/pre-commit .git/hooks/post-commitHow to configureThere are a few settings that can be configured through environment variables, defined incson_to_markdown/config.py.
We will by default first look at an appropriately named environemnt variable, and fall back to the defaults if none were found.These are the current settings, which work for the Boostnote use-case specifically._config={"MARKDOWN_START":"content: '''","MARKDOWN_END":"'''","TITLE_INDICATOR":'title: "',"FOLDER_INDICATOR":'folder: "',"YAML_STRING_INDICATOR":'"',"CSON_EXTENSION":".cson","MARKDOWN_EXTENSION":".md","METADATA_EXTENSION":".yml","METADATA_FOLDER":"meta","BNOTE_SETTINGS_FILE":"boostnote.json",}To overwrite, simply set a new environment variable in your terminal, or add it to your.bashrcfile:export MARKDOWN_START="new start delimiter"