mkshp-dev95 downloadsDynamically generate Maps of Content (MOC) by extracting matching list items from notes in your vault.
This plugin provides a dynamic way to extract elements (like lists, tasks, headings, paragraphs, or blockquotes) from your Markdown files that match a specific word filter, automatically generating Map of Content (MOC) indexes in your vault.
It accomplishes this by adding a new moc markdown code block processor.
In any of your notes, add a code block with the language set to moc and provide a YAML-based configuration.
Here is an example:
```moc
folder: Diary
element: List
filter: has_word("MOC")
recursive: true
```
folder (required): The folder path within your vault to search for files. E.g., Diary or Notes/Meetings.element (required): The type of element to extract. Can be set to List, Task, Heading, Paragraph, or Blockquote.filter (required): The filter condition to apply to each element. Supported formats include:has_word("word") or contains("text") or has_text("text"): Matches elements containing the exact text.matches("regex"): Matches elements using a regular expression.has_tag("#tag"): Matches elements containing the specified tag.is_completed(): Matches only completed tasks (when element is Task).is_incomplete(): Matches only incomplete tasks (when element is Task).recursive (optional): A boolean (true or false) that determines whether the search should include subfolders within the specified folder. If omitted, it defaults to false.You can dynamically include the current note's parameters in the folder and filter options using the following variables:
{{this.filename}}: Expands to the current note's name (without the .md extension).{{this.folder}}: Expands to the name of the folder containing the current note.{{this.path}}: Expands to the full path of the current note (without the .md extension).For example, to list elements from the Diary folder that contain the current note's name:
```moc
folder: Diary
element: List
filter: has_word("{{this.filename}}")
recursive: true
```
The plugin will scan all markdown files in the specified folder. For any files containing elements that match your filter, it will dynamically render a section.
The rendered output includes:
Note: The original
moccode block is replaced in reading/preview mode with the dynamically generated content.
If you find this plugin helpful, consider supporting its development!