{"id":16587586,"url":"https://github.com/danymat/obsidian-markdown-parser","last_synced_at":"2025-03-21T13:30:46.924Z","repository":{"id":47484498,"uuid":"334079983","full_name":"danymat/Obsidian-Markdown-Parser","owner":"danymat","description":"This repository will give you tools to parse and fetch useful informations of your notes in your Obsidian vault.","archived":false,"fork":false,"pushed_at":"2021-08-30T02:36:04.000Z","size":104,"stargazers_count":57,"open_issues_count":2,"forks_count":6,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-18T01:42:28.371Z","etag":null,"topics":["markdown-parser","markdownfile","obsidian","obsidian-extractor","obsidian-markdown-parser","obsidian-md","obsidian-vault","parser","python","vault","yaml","zettelkasten"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danymat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-01-29T08:17:27.000Z","updated_at":"2025-03-02T22:18:00.000Z","dependencies_parsed_at":"2022-08-20T00:40:49.077Z","dependency_job_id":null,"html_url":"https://github.com/danymat/Obsidian-Markdown-Parser","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danymat%2FObsidian-Markdown-Parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danymat%2FObsidian-Markdown-Parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danymat%2FObsidian-Markdown-Parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danymat%2FObsidian-Markdown-Parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danymat","download_url":"https://codeload.github.com/danymat/Obsidian-Markdown-Parser/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244806049,"owners_count":20513368,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["markdown-parser","markdownfile","obsidian","obsidian-extractor","obsidian-markdown-parser","obsidian-md","obsidian-vault","parser","python","vault","yaml","zettelkasten"],"created_at":"2024-10-11T22:54:35.557Z","updated_at":"2025-03-21T13:30:46.602Z","avatar_url":"https://github.com/danymat.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Obsidian Markdown Parser\n\n![(Github All Releases)](https://img.shields.io/github/downloads/danymat/Obsidian-Extractor/total)\n\nThis repository will give you tools to parse and fetch useful informations of your notes in your Obsidian vault.\n\n## Motives\n\nI like to do some python scripts with my vault, so this repository is the tool I needed in order to parse my Markdown files.\n\n## State of the Art\n\nAt the moment, I have implemented a basic parsing library.\n\n### Parser\n\n#### Usage\n\n```python\nfrom src.Parser import Parser\nparser = Parser('/path/to/vault')\n```\n\nBy default, the parser will ignore `.git` and `.obsidian` sub-directories.\n\nIf you want to specify which directories to ignore, it has to be done at instanciation.\n\n```python\nparser = Parser('/path/to/vault', ignoredDirectories=['directory1', '.obsidian', '.git'])\n```\n\nBe careful, it will rewrite `.git` and `.obsidian`, so please add them back in the ignoredDirectories if you want to ignore them plus the ones you specified.\n\n#### Attributes\n\n- `mdFiles` Array of MarkdownFile in vault\n\n#### Methods\n\n- `findSubFilesForFiles(files)` returns a set of `MarkdownFile` linked with the **set** of `MarkdownFile` specified\n- `searchFilesWithTag(tag)` returns a set of `MarkdownFile` with a specified tag\n\n\n### YamlParser\n\n#### Usage\n\n```python\nfrom src.yamlParser import YamlParser, YAML_METHOD\n\n# the file contents need to be read\nfile = MarkdownFile\nfile = self._openFile()\nself.fStream = file.read()\nfile.close()\n\nfindYAMLTags = YamlParser(self.fStream)\n# find all values for a particular key\n# this will return a set with the values that have \"tags\" as key\nvalues = findYAMLTags.findAllYAML(YAML_METHOD.FIND_VALUE, \"tags\")\n\n\nyamlIterator = YamlParser(self.fStream)\n# return all keys and values as a dictionary with the key as string and its values as set\nprint(yamlIterator.findAllYAML(YAML_METHOD.ITERATE))\n```\n\n#### Methods\n\n- `.findAllYAML()` with the parameters `YAML_METHOD.FIND_VALUE` and `\"{key}\"` with `{key}`\n  as the YAML key returns the associated values as a set\n- `.findAllYAML()` with the parameter `YAML_METHOD.ITERATE` will return all key-value\n  pairs in YAML as a dictionary with the key as a string and its associated\n  values as a set\n\nCurrently, the YAML parser is limited [(see the comments for details)](https://github.com/danymat/Obsidian-Markdown-Parser/blob/main/src/YamlParser.py).\n\n### MarkdownFile\n\n#### Attributes\n\n- `fileName` file name (string) of the current markdown file, with `.md` extension (e.g `'file.md'`)\n- `path` relative path (string) of the current markdown file (e.g `'testVault/file.md'`)\n- `tags` set of tags in current file (e.g `{'tag2', 'tag3'}`)\n- `links` set of links in markdown files (e.g `{'file2'}`)\n\n### Examples\n\n```python\nparser = Parser('test/testVault')\n```\n\n- Find all fileNames that doesn't have a tag\n\n```python\nfileWithoutTags = [file.fileName for file in parser.mdFiles if len(file.tags) == 0]\n```\n\n- Find all files that have `tag1` in them\n\n```python\nfilesWithSpecificTag = [file for file in parser.mdFiles if 'tag1' in file.tags]\n# OR\nfilesWithSpecificTag = parser.searchFilesWithTag('tag1')\n```\n\n## Roadmap\n\nNew features I intend to add:\n\n- [ ] Add more tests\n- [X] Ignore .obsidian/ folder\n\n\n## Contributing\n\nIf you would like to add shiny new features, or correct bugs I unfortunately added, please fork\nthis repository, and create a pull request from it. Below is the list of all contributors for this repository, if you contributed please consider adding your name !\n\nContributors:\n\n- Daniel Mathiot ([danymat](https://github.com/danymat))\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanymat%2Fobsidian-markdown-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanymat%2Fobsidian-markdown-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanymat%2Fobsidian-markdown-parser/lists"}