Metadata 1.0 Docs

linkReadme:

Using this Plugin, you can generate a dump of Note Names + their respective Tags.

You have extensive methods to filter that data that you are looking for.

You have multiple ways to place your requested data in.


linkDemo:

linkGeneral - Calling the Plugin - Metadata 1.0




linkTag Selection



linkTyping in Note Name



linkSort by Note Name; Tags; Tags (Within a Note)



linkInsert / Export Options; Select format [Mandatory]



Published only (Table format) - Added the option of selecting the list of Published Notes. Having both the local UUID and the Public URL side by side. (Good for Reviewing purposes!).

Raw data - Gives you Note Name, UUID, Tags.


linkDetailed breakdown:

linkHigh-Level Functionality

User Input Prompting:

Prompts the user for various filter criteria and options.

Collects tags, name filter, sorting options, and format options from the user.

Filtering and Sorting Notes:

Filters notes based on user-provided tags and name.

Sorts the filtered notes based on user-selected options (note name, tags).

Generating and Exporting Results:

Generates a formatted output based on the user’s input.

Allows the user to either insert the output into a note, create a new note, or download the output in different formats (Markdown, CSV, TXT).

linkDetailed Breakdown

linkPrompting User for Input

app.prompt:

Prompts the user to enter filter criteria.

Inputs include tags, name filter, sorting options, and export options.

Ensures the user selects required fields (insertOption and insertFormat).

linkFiltering and Sorting Notes

Tag Filtering:

Splits user-entered tags into an array.

Filters notes based on these tags using app.filterNotes.

Removes duplicate notes.

Name Filtering:

Filters notes further if a name filter is provided.

Sorting Notes:

Sorts notes by name (ascending or descending) based on user selection.

Fetches tags for each note and sorts tags alphabetically within a note if the user selected that option.

Sorts the final list of results based on the selected tag sorting option.

linkGenerating and Exporting Results

Formatting Results:

Formats results based on user-selected format options (both_table, names_only, tags_only, published_only, raw_data).

All the Available Options! as on July 31st, 2024

Adds the formatted results to a set to ensure uniqueness.

Creating Markdown Links:

Creates Markdown links from note handles.

Generating File Content:

Creates the result text and CSV content based on the selected format.

Generates a filename based on the current date and time.

Appends a summary of input selections to the result text and CSV content.

Inserting or Downloading Results:

Inserts the result text into the current or a new note based on user selection.

Allows the user to download the result in Markdown, CSV, or TXT format.

linkSorting Options

Sort by Note Name:

sortOption: Sorts notes by their names.

asc: Ascending order.

desc: Descending order.

Sort by Tags:

sortTagOption: Sorts the list of results by tags.

asc: Ascending order.

desc: Descending order.

Sort Tags Alphabetically within a Note:

sortTags: Boolean option to sort tags within a note alphabetically.

linkExample Workflow

User Input:

Tags: tag1, tag2

Name filter: Note

Sort by note name: asc

Sort tags alphabetically: true

Insert option: new_note

Format: both_table

Filtering:

Filters notes containing tag1 or tag2.

Further filters notes with names containing Note.

Sorting:

Sorts the filtered notes by name in ascending order.

Sorts tags within each note alphabetically.

Result Generation:

Creates a table with note names and their tags.

Inserts the table into a new note.

linkConclusion

The code provides a comprehensive solution for filtering, sorting, and exporting notes based on user-defined criteria. Ensuring the correct application of sorting options is crucial for achieving the desired output. If sorting does not work as expected, it may be due to the interplay between different sorting options and the handling of duplicate notes.