RichTextColorizer Examples? #227
Replies: 3 comments 15 replies
-
TextMate extension already changes the colors and sets up the font as bold/italic/underline. You can take a look at how it works here: |
Beta Was this translation helpful? Give feedback.
-
var richTextModel = new RichTextModel();
richTextModel.SetForeground(0, 10, new SimpleHighlightingBrush(Colors.Red));
richTextModel.SetForeground(15, 20, new SimpleHighlightingBrush(Colors.Red));
_textEditor.TextArea.TextView.LineTransformers.Add(new RichTextColorizer(richTextModel)); But it seems that the |
Beta Was this translation helpful? Give feedback.
-
I understand your interest in the other thread now, and I apologize for missing that and this discussion here. I can roughly explain the way that I accomplished what you were trying to do here:
It's still rough, but it seems to do the job. By taking the generator approach, it will be possible to do things like hide the emphasis characters by generating a custom By constructing the BVH using Currently I'm working with their #216 branch, which has a bunch of performance improvements and fixes an error in line breaks (#228) when you use the generator based approach above, but there's some formatting issues they're working through so it's not completely functional yet. My plan for my own markdown editor is to GPL3 it. As I mentioned in the other thread I would be happy for any assistance on it, but if the vision I have doesn't match what you're thinking for your novel editor, I can break the Markdig/AvaloniaEdit specific code out into a separate project which we can both share between our respective projects, and I can release that particular code on a more permissive license. Let me know if you're interested. |
Beta Was this translation helpful? Give feedback.
-
I see the RichTextColorizer in the repo, but I don’t how to use it.
I assume it’s something like avalonedit, eg:
editor.TextArea.TextView.LineTransformers.Add(new RichTextColorizer());
, but even if that’s right I don’t know how to actually make it do anything.Like suppose I have the sample code from the Demo folder of this repo, I want to add rich text formatting to that demo, so I can run the rich text demo, highlight some text in the editor, and italicize it with any or all of: a button or key combo or some kind of pattern matching (eg.
_italics_
).How would I do that?
Beta Was this translation helpful? Give feedback.
All reactions