0

I am using codemirror with primefaces extensions in XML Mode. Now, I have to change the font of substring to Bold. For example

<User>
    <Name>Micheal</Name>
    <Age>25</Age>
    <Address>**NewYork**</Address>
</User>

Here NewYork should be in Bold and mode should be XML. Please help me how to achieve this, I am using codemirror for the first time. Thanks in advance.

Gans
  • 129
  • 2
  • 11
  • I don't see any PrimeFaces usage in here... Did you try with plain codemirror? Does it work then? – Kukeltje Mar 11 '16 at 19:33
  • I used like this It is working, I can see XML Highlighting. But my question is how to change font of one attribute 'NewYork' to Bold ? – Gans Mar 12 '16 at 20:43
  • And my question was: does it work/can it be achieved with plain codemirror – Kukeltje Mar 12 '16 at 22:07

1 Answers1

0

If you know where your substring is, you can call markText to add a CSS class to it.

(That was linked to http:/codemirror.net/doc/manual.html#markText , but apparently StackOverflow helpfully removes the link as some kind of heavy-handed anti-spam measure?)

Marijn
  • 8,691
  • 2
  • 34
  • 37
  • Thanks for the help. I am using markText but it is not working. I am using like this doc.markText({line:3,ch:14},{line:3,ch:20},"font-weight: bold"); – Gans Mar 16 '16 at 02:44
  • Your last argument isn't the kind of thing that the function expects. Check the docs. – Marijn Mar 18 '16 at 11:19