Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add all Headings to every List-Item #2330

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

SpocWeb
Copy link

@SpocWeb SpocWeb commented May 14, 2024

In Response to #2290 and #2325 I have prepared this minimal Prototype.
@blacksmithgu Please consider this as a basis for discussion, I am not pushing for this exact Design,
but including the Heading Hierarchy would increase the Expressivity very much.

This adds a new List to every ListItem containing the path of containing Headings in strictly monotonously decreasing Levels.
This forms a kind of xPath or jsonPath to each List Item
and thus helps to organize multiple Lists within the same Markdown Document in markdown.ts:

export class ListItem {
    symbol: string;
    link: Link;
    section: Link;
    /** List of all Headings 'above' this one in ascending Order, to be able to properly group List Items */
    headings: HeadingCache[];
    ...

I am unsure on how to handle the serialize(cache: ListSerializationCache): SListItem-Operation in PageMetadada.tx (line 260)
It does not seem to support the Obsidian HeadingCache Class, so I am converting it to a List of Heading-Strings
with proper number of #s to indicate the correct Heading Level
headings: this.headings.map(h => "#".repeat(h.level) + " " + h.heading),

Best Regards and thank you for this powerful component. I am aware that there are many factors to consider for the evolution of the DataView.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant