gitextensions / ICSharpCode.TextEditor

ICSharpCode.TextEditor for WinForms
14 stars 22 forks source link

Add markdown (.md) highlight support #11

Closed pmiossec closed 4 years ago

pmiossec commented 4 years ago

Screenshot

image

drewnoakes commented 4 years ago

Does this support code blocks via ``` and four-space-indent?

Did you author these? Consider also looking at:

pmiossec commented 4 years ago

@drewnoakes

Does this support code blocks via ``` and four-space-indent?

No. That's just a basic MarkDown support I made myself. I consider it just good enough but that already add some value.

It was really painful to write as I don't really understand how the parsing works 😢

Consider also looking at:

I had a look to see if I found something already working but didn't one. I evaluated 3 or 4 without one working...

https://github.com/icsharpcode/AvalonEdit/blob/master/ICSharpCode.AvalonEdit/Highlighting/Resources/MarkDown-Mode.xshd

I'm pretty sure I tested this one but it is for a more recent version of the control where the parser have changed and is not compatible. We're stuck with a very old version 😢

https://github.com/ddevault/Halibut/blob/master/Halibut/Highlighting/markdown.xshd

I don't remember if I have evaluated this one but I will have a look again (even if the syntax seems not to be the good one)

drewnoakes commented 4 years ago

@pmiossec I would not block this PR as it definitely improves support.

it is for a more recent version of the control where the parser have changed and is not compatible

Oh right, I see. AvalonEdit is the WPF version. It's too bad they're not compatible.

I'm interested in decent markdown support within GE for use in other places too, such as commit message rendering.

pmiossec commented 4 years ago

Consider also looking at:

Both of them don't work, even adapted. I think that's because our current parser doesn't support RegEx

I'm interested in decent markdown support within GE for use in other places too, such as commit message rendering.

Without regex support, it will be difficult...

Does this support code blocks via ```

I have added that (and also inline code).

and four-space-indent?

I tried but it didn't worked 😢

RussKie commented 4 years ago

AvalonEdit is the WPF version

We can host WPF islands in WinForms (in fact we are already doing this). So if AvalonEdit is something we can use and replace the dated ICSharpCode.TextEditor - sure, by all means let's discuss.

pmiossec commented 4 years ago

I think I've done what I could.

I don't want to touch it anymore. I spent too much time on that frustrating feature.

I know it's far from perfect but good enough for a first try and I don't see how to fix the remaining unsupported features.

I let to someone else the work to improve it (and spend hours on it!) .

gerhardol commented 4 years ago

I think I've done what I could.

Only Drew's three comments....

I believe this is good enough

pmiossec commented 4 years ago

Only Drew's three comments....

@gerhardol Done. Fixed 2. The last one was not done because I failed to do it...

RussKie commented 4 years ago

Drew, are ok with the current state?

On Tue, Oct 15, 2019, 11:13 PM Philippe Miossec notifications@github.com wrote:

Only Drew's three comments....

@gerhardol https://github.com/gerhardol Done. Fixed 2. The last one was not done because I failed to do it...

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/gitextensions/ICSharpCode.TextEditor/pull/11?email_source=notifications&email_token=ABBTEXTWOY44IKW7AJEFCTDQOWXU7A5CNFSM4I4HIIV2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBIQQCI#issuecomment-542181385, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABBTEXULR6NGQWTDLOXRH6DQOWXU7ANCNFSM4I4HIIVQ .

pmiossec commented 4 years ago

I have added a sample file to be able to see the result easily (and for someone who wants to improve the markdown support later)

Doc: What prevent to do a better highlighter:

RussKie commented 4 years ago

Merging as is, we can always return to it, if necessary

drewnoakes commented 4 years ago

Nice one.