1

I'm trying to set a user defined language in Notepad++ to bold all text between asterisks followed by space.

I've clicked on user defined language and then create new language, then in comments tab I set for "open" and "close" an *. This works but if the string is followed by a point, I don't want the rule bold that text.

For example in the following string

*Hello*. How are you doing? Fine. *Thank you* .

I only want Thank you to be bold because the * after "you" is separated from the point . with a space. In the other hand, I don't want Hello to be bold because the * after the "o" is inmediately followed by a point.

Will look like this:

*Hello*. How are you doing? Fine. Thank you .

How can I do this?

Ger Cas
  • 2,188
  • 2
  • 18
  • 45
  • You can define Open = `*` and Close = `*` However that will not work the way you expect. Here: `*Hello*. How are you doing? Fine. *Thank you* .` The first `*` before `Hello` will be the start of the comment. Then. Since the next `*` is not followed by a space, it will be trated as plain text. Same for third `*`. So the comment will reach to the end (last/fourth) `*`, that is followed by a space. – Julio Aug 22 '18 at 11:32
  • Hi Julio. Thanks for your answer. As you said, it doesn't work as expected. Maybe the solution is more complex or not possible in Notepad++. do you know if in another text editor this could be possible? The behavior I'm looking for is similar to how it works the syntax formatting for YouTube comments. – Ger Cas Aug 23 '18 at 18:48

1 Answers1

0

I was able to reach results on advanced highlighting requirements with user-defined languages in SynWrite editor. UDL Notepad++ highlighting mechanism UDL2 is deliberately kept at some level of simplicity. (There's always balance to be found between usability and complexity.) So Synwrite's UDL engine allows more complex language parsing constructs including setting of parsing state (context) etc. But of course this comes hand in hand with the need of more learning. Anyway, in my case, after that learning, all my highlighting requirements were fully covered there.

miroxlav
  • 11,796
  • 5
  • 58
  • 99