Getting H1 heading

Things I have tried

Sometimes ago I asked some help about retrieving H1 headings from MD files in:

What I’m trying to do

I want to retrieve H1 headings of my notes and create a list, a summary (or table of contents). As I explained I put the name of my notes in H1 headings and the filenames have a ZettelKasten style, just date-hour-min-seconds.
Does someone have a tip of how to come up with a list of my H1 heading coming from several md files in a directory?
Many thanks!

1 Like

You can try installing the Text Expand plugin. GitHub - mrjackphil/obsidian-text-expand: A simple text expand plugin for Obsidian.md

Then, add the expander code to a note. Something like this could work for you:

```expander
- $header:#
```

Finaly, run the expand command to create the list

Hi, many thanks! Unfortunately, it insists in returning only the filename, not the heading. See some results:

  • ![[3145b66d1e90d0b5b9bfa87b46f9f5d7.png]]
  • ![[4731ad1572cc5bd271978015ec68892a.png]]
  • ![[251821c560b0676c639f8c40d408a9c9.png]]
  • [[202072211401]]
  • [[202106041950]]
  • [[202106041951]]

You can try the Concatenate Plugin

Thank you, but I think it is not the case. I can’t see how the plugin can help me in this case.

Cumprimentos na língua de Camões.

About you question, my only suggestion is:

  • create an aliases field in YAML frontmatter in each note with the wanted “title”
---
aliases: My title
---
  • create an inline field with your summary
summary:: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean eu mi odio. Integer at nulla ut felis pharetra ultrices vitae eget dui. 
  • use the plugin Dataview to create your list or table with the wanted title and the summary.
```dataview
TABLE WITHOUT ID link(file.link, aliases) AS Título, summary AS Resumo
```

Obrigado!!
Many thanks, mnavwvnm, I will try it!

Hi!

If you’re comfortable with running python scripts from the command line, I believe this will do the trick.

  1. Download and unzip this file: list_titles.zip (925 Bytes)
  2. In the command line, cd into the directory where you saved the file.
  3. Type python3 list_titles.py "/path/to/your/vault" and press Enter.
  4. Check you notes for a new file called List of all note titles.md

:warning: Be sure to backup your vault regularly, but especially before running any scripts that manipulate your notes. This one’s pretty innocuous, but you never know.

If you try this and run into any issues, let me know. I’ll be glad to assist you.

Cheers.

1 Like

Hi macedotavares, many thanks for this!! It works!
Here is a snapshot of the list
image
I appreciate your willingness!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.