1

in my markdown files I have a summary at the top with inner links to the document headers. Something like this:

   # my doc
   ## Summary
     * [Introduction](#intro)
     ...
   
   ## <a name="intro"></a>Introduction
   Lorem blahblahblah

I have customized the heading delimiters to appear with the same color of comments using the following statement:

   hi def link markdownHeadingDelimiter Comment

I would like to customize the entire part represented by the inner anchor <a name="intro"></a>.

How can I do that?

Sixro
  • 402
  • 4
  • 16

1 Answers1

2

You can use the following command to see what highlight group is assigned to the text under your cursor:

:command! SynStack echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')

In this case, every single character of <a name="intro"> belongs to htmlTag and every single character of </a> belongs to htmlEndTag so that's a start. But there are other highlight groups at play, like htmlString, and you will have to deal with them individually.

romainl
  • 186,200
  • 21
  • 280
  • 313
  • Hi and thanks. I'm trying to run that command but nothing appears... – Sixro May 23 '21 at 12:39
  • 1
    In the end I used a function copied from [this answer](https://stackoverflow.com/a/5825964/1362003) and with your suggestion I have been able to fix. Basically I had to link the following highlight groups: htmlTag, htmlTagName, htmlString, htmlArg and htmlEndTag – Sixro May 23 '21 at 13:11