Tagging paragraphs, range where term is in attribute lists {.myclass}?

I’m wanting to tag paragraphs and other content. I can do this in ctags or asccidoctor like this [#tag] but in hugo the workaround would be… attribute lists after Markdown blocks? I’m not sure if this is the best way to go about it. I want like a summary.html of everything that contains the tag {.someclass}. For example:

TERMS PAGE term.html →

HUGO HOW TO

This is a paragraph that was contains the class hugo.

CSS HOW TO

Hugo has a directory named static where you can put your css. This also has the class hugo.

MARKDOWN —>

hudo.md
This is a paragraph that was contains the class hugo.
{.hugo}

css.md
Hugo has a directory named static where you can put your css. This also has the class hugo.
{.hugo}

I enabled block = true for goldmark. I need all the regular pages. If a class/attribute list contains the term list page that I’m on render that paragraph,code block, etc… This is the code that I’m thinking about, not sure?

terms.html

{{$current_term := .Title}}
{{ range .Site.RegularPages }}
     {{if in $current_term class}}, {{ .Render "show-paragraphs" }}
    {{end}}
{{ end }}

None.

Well, I figured out a work around. The only down side to this is that all the pages are rendered. Which is probably not a big deal if there are only a few documents. Remove all the elements with javascript/css class that don’t match ( e.g., display none or visibility none, parent.textContentBody = “”). Then parent.appendChild(clones).

Another solution would be to call an external program like ripgrep, head, and tail then feed it to hugo but not sure if that’s possible with hugo.