Highlighting of matching markup tags in text

SyntaxEditor for Windows Forms Forum

Posted 14 years ago by Joachim Schwieren
Version: 4.0.0282
Avatar
Hi,

what is the easiest way to highlight matching tags in a markup document when the cursor is on the opening or closing tag?

E.g. if you have:

<html><body>...</body></html>

and the caret is on <html> it should highlight <html> and </html> e.g. with an underlining or a differend background color.

The concept is basically the same as with bracket highlighting but for markup tags this time.

Any ideas how to accomplish that?

Thanks for your help,

Joe

Comments (1)

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Joe,

On selection change events in the selected view you'd want to figure out if you are in a tag or not. You can do this with token scanning via TextStream (use the Document.GetTextstream() method to create one). If you are, then have a custom span indicator layer in place for your highlights. And add two span indicators, one for the start range and one for the end. You can use span indicators to show highlights, etc. There is a QuickStart for making custom highlights in the sample project.

Hope that helps.


Actipro Software Support

The latest build of this product (v24.1.0) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.