Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2023-01

SynEdit highlighter for Markdown

6 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Andrew Haines

Hi, I attached a highlighter I made for Markdown. I like to use this in my projects to plan things.

It seems to work fine with any attribute that only requires a single line. I tried and failed to make multiline fenced code work. I'm sure there is just something I wasn't understanding.

```

multiline

code

block

```

Indenting works though.

If anyone has some clues I'd love to know what I did wrong :)

Regards,

Andrew Haines
-------------- next part --------------
A non-text attachment was scrubbed...
Name: synhighlightermarkdown.pas
Type: text/x-pascal
Size: 24726 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20230105/af5d7a4a/attachment-0001.pas>

Reply by email

Martin Frb
to Andrew Haines

Without yet having looked at it (currently got a bit of an incoming queue)...

But there is a tutorial on how HL work:
https://wiki.freepascal.org/SynEdit_Highlighter

Andrew Haines wrote 28 lines
Hi, I attached a highlighter I made for Markdown. I like to use this in my projects to plan things. It seems to work fine with any attribute that only requires a single line. I tried and failed to make multiline fenced code work. I'm sure there is just something I wasn't understanding. ``` multiline code block ``` Indenting works though. If anyone has some clues I'd love to know what I did wrong :) Regards, Andrew Haines

Reply by email

Michael Van Canneyt
to Andrew Haines: Hi, I attached a highlighter I made for Markdown. I like to use this in my projects to…
Andrew Haines wrote 19 lines
Hi, I attached a highlighter I made for Markdown. I like to use this in my projects to plan things. It seems to work fine with any attribute that only requires a single line. I tried and failed to make multiline fenced code work. I'm sure there is just something I wasn't understanding. ``` multiline code block ``` Indenting works though.

Nice start, I will add it to my IDE, awaiting the 'official' addition to lazarus :-)

Given the many dialects in markdown (specially for multiline/continuation things), it'll be interesting to see how it reacts on them :)

Michael.

Reply by email

Andrew Haines
to Martin Frb: Without yet having looked at it (currently got a bit of an incoming queue)... But there…
Martin Frb wrote 7 lines
Without yet having looked at it (currently got a bit of an incoming queue)... But there is a tutorial on how HL work: https://wiki.freepascal.org/SynEdit_Highlighter

After some careful examination(I had already seen that page) I found the problem was in GetRange I was calling inherited at the start instead of at the end. Always little things :) Thanks for the hint.

I'm hoping to include this in Lazarus if anyone is interested. I've got some further improvements I'm working on.

Thanks

Andrew Haines

Reply by email

Andrew Haines
to Andrew Haines
Andrew Haines wrote 18 lines
On 1/5/23 6:23 PM, Martin Frb via lazarus wrote: > Without yet having looked at it (currently got a bit of an incoming > queue)... > > But there is a tutorial on how HL work: > https://wiki.freepascal.org/SynEdit_Highlighter > > After some careful examination(I had already seen that page) I found the problem was in GetRange I was calling inherited at the start instead of at the end. Always little things :) Thanks for the hint. I'm hoping to include this in Lazarus if anyone is interested. I've got some further improvements I'm working on.

I've completed I think the most common markdown features and am installing it in the IDE. I did a search for JScript(another highlighter) to find the places in the IDE to modify.

The highlighter loads if I open a *.md file.

The default color I assigned in the source seem to be ignore but I was able to set new ones using Settings - Editor - Display? - Colors and selecting Markdown from the top.

I attached my changes to lazarus and also the new highlighter unit. -------------- next part --------------
A non-text attachment was scrubbed...
Name: markdown.zip
Type: application/zip
Size: 12020 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20230107/77d00f20/attachment.zip>

Reply by email

Graeme Geldenhuys
to Michael Van Canneyt: Nice start, I will add it to my IDE, awaiting the 'official' addition to lazarus :-)…
Michael Van Canneyt wrote
Given the many dialects in markdown (specially for multiline/continuation things), it'll be interesting to see how it reacts on them ?

Hence I always recommend AsciiDoc over Markdown. ;-) There are many basic documentation concepts that MD simply doesn't support. Just to name a few:

* Built-in comment support
* Admonition blocks
* More control over images
* More control over lists
* Better table handling
* Auto table-of-content generation (not all MD dialects support this)
* AsciiDoc is one standard and dialect
* AsciiDoc never needs to embed HTML to accomplish something, because the target might not always be HTML.

Just my 2? worth. :)

Regards,
- Graeme -

Reply by email