Skip to content

A Python3 Helper Script: heading >> table parser and survey tool for Obsidian *.md Files.

Notifications You must be signed in to change notification settings

Web3dGuy/obsidian-heading-parser

Repository files navigation

Obsidian Tools - Markdown heading parser


#python_helpers #format_tools #obsidian

Turn This:

Heading questions, with answers

Into This:

Headings parsed into a table format

Step Through/Survey Mode:

Stepping through each heading and giving an answer in survey mode

Python Version:

  • The script was tested on Python v3.11.5 but should work with >= v3.0.

Options

  • --novalues Leaves all value fields empty in the output.
  • --table Formats the output in markdown table format.
  • --survey Interactive mode that prompts for values for each attribute.
  • --help Prints the manual/help for the script.
  • --force Disables error catching. File should start with a heading.

Survey Commands

When in survey mode, the following commands can be used:

  • /skip Skip the current attribute, leaving the value blank.
  • /asis Leave the current attribute's value as is.
  • /end End the survey, leaving the remaining attributes as they were.
  • /skipend End the survey, skipping all remaining attributes and leaving them blank.

Restrictions

Note that --survey and --novalues options cannot be used together as they are mutually exclusive.

Function Descriptions

  • parse_markdown(md_content): Parses the Markdown content and returns structured data.
  • survey_mode(parsed_data): Interactive survey mode for user input.
  • create_output(parsed_data, output_file, novalues, table_format): Generates the output Markdown file based on the structured data.
  • print_help(): Displays the help text for the script.

Examples

Run the script to parse example.md and write to output.md:

heading_parser.py example.md output.md

Generate a table format output with empty values:

heading_parser.py example.md output.md --table --novalues

Run in survey mode:

heading_parser.py example.md output.md --survey

Generate a table format output:

heading_parser.py example.md output.md --table

License

This script is provided "as is", without warranty of any kind. You may use, modify, and distribute it freely.

About

A Python3 Helper Script: heading >> table parser and survey tool for Obsidian *.md Files.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages