nickb
                (Nick)
              
                
              
                  
                  
              1
              
             
            
              Probably easy one … I have a headings with tags and ‘contained’ text. How might I return the text ‘below’ a heading? For example, with:
## My heading #aheadingtag
Item content here.
More item content.
## My heading2 #anotherheadingtag
Item2 content here.
More item2 content.
… how would I return all the text for #aheadingtag, which would be:
Item content here.
More item content.
Thanks
             
            
              
              
              
            
                
            
           
          
            
              
                Aese
                
              
              
                  
                  
              2
              
             
            
              In theory, something like ![[Test#My heading #aheadingtag]] would work, but it doesn’t seem to function with a tag in it.
So here’s some template code that’s technically functional, if a little fragile:
{{#let @startPos = at({header where page = @page.name and at(tags,0)="aheadingtag" select pos},0)}}
  {{#if @startPos}}
    {{#let @endPos = at({header where page = @page.name and pos > @startPos.pos select pos},0)}}
      {{#if @endPos}}
        {{#each {paragraph where page = @page.name and pos > @startPos.pos and pos < @endPos.pos}}}
{{text}}
{{/each}}
      {{else}}
        {{#each {paragraph where page = @page.name and pos > @startPos.pos}}}
{{text}}
{{/each}}
      {{/if}}
    {{/let}}
  {{/if}}
{{/let}}
             
            
              
              
              1 Like