Re: [Lazarus] SynEdit highlighter for Markdown
On 1/6/23 9:36 AM, Andrew Haines via lazarus wrote: 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. <> -- ___ lazarus mailing list lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] SynEdit highlighter for Markdown
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. Thanks Andrew Haines -- ___ lazarus mailing list lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
[Lazarus] SynEdit highlighter for Markdown
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 {--- The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. Author of this file is Andrew Haines. All Rights Reserved. Contributors to the SynEdit and mwEdit projects are listed in the Contributors.txt file. Alternatively, the contents of this file may be used under the terms of the GNU General Public License Version 2 or later (the "GPL"), in which case the provisions of the GPL are applicable instead of those above. If you wish to allow use of your version of this file only under the terms of the GPL and not to allow others to use your version of this file under the MPL, indicate your decision by deleting the provisions above and replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. $Id$ Known Issues: Features that require multiple lines do not work Tables are not highlighted Links are not handled Superscript/subscript Probably more. ---} { @abstract(A Basic Markdown language highlighter for SynEdit) @author(Andrew Haines>) @created(2023-01-03) The SynHighlighterMarkdown implements a highlighter for Markdown for the SynEdit projects. } unit SynHighlighterMarkdown; {$mode ObjFPC}{$H+} {$ModeSwitch typehelpers} { $define TryMultiLine} interface uses Classes, SysUtils, Graphics, SynEditTypes, SynEditHighlighter, SynEditHighlighterFoldBase, fgl; type { TSynMarkdownRange } TSynMarkdownRange = class(TSynCustomHighlighterRange) private FIsInFencedCodeBlock: Boolean; procedure SetIsInFencedCodeBlock(AValue: Boolean); public property IsInFencedCodeBlock: Boolean read FIsInFencedCodeBlock write SetIsInFencedCodeBlock; procedure Clear; override; function Compare(Range: TSynCustomHighlighterRange): integer; override; procedure Assign(Src: TSynCustomHighlighterRange); override; function MaxFoldLevel: Integer; override; end; { TSynMarkdownSyn } TSynMarkdownSyn = class(TSynCustomFoldHighlighter) private type TAttr = (atText, atH1, atH2, atH3, atUnorderedList, atItalic, atBold, atBlockQuote, atCode, atFencedCode, atStrikethrough, atHighlight, atStrongBold, atHorizontalRule, atEmoji, atOrderedList, atUnderline, atIndentedCode, atHeaderAlt); TAttrs = set of TAttr; const Tokens : array [TAttr] of String = ( #255, '#', '##', '###', '-', '*', '**', '>', '`', '```', '~~', '==', '***', '---', ':', #255, '__', '', '' ); TokenIsPair: array [TAttr] of Boolean = ( False, False, False, False, False, True, True, False, True, True, True, True, True, False, True, False, True, False, False ); TokenIsFirst: array [TAttr] of Boolean = ( // meaning only whitespace is allow before it False, True, True, True, True, False, False, True, False, False, False, False, False, True, False, True, False, True, True ); TokenIsVarLength: array [TAttr] of Boolean = ( False, False, False, True, False, False, False, True, False, True, False, False, False, True, False, False, False, True, True ); TokenIsMultiline : array [TAttr] of Boolean = ( False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False ); SpecialChars: TCharArray = ( '#', '*', '>', '`', '=', '-','[',']','{','}', '^', '|', '~', ':', '_', '+', ' ' ); cHeaderAttr = [atH1, atH2, atH3, atHeaderAlt]; type TRange = (rCode); TRangeSet = set of TRange; { TAttrInstance } TAttrInstance = Class private FText: PChar; public Attr: TAttr; Start: PChar; Length: Integer; Matched: Boolean; function IsWhitespace: Boolean; function Text: String; constructor Create(AAttr: TAttr; AStart: PChar; ALength: Integer); function NeedsMatch: Boolean; end; TMultiLine = class StartLine: Integer; EndLine: Integer;
Re: [Lazarus] stale pipe workarounds
On 11/19/2016 10:50 PM, Lars via Lazarus wrote: Hi while researching help systems I came across the code which uses IPC to communicate and see that people are adding stale pipe work arounds. So this can't be resolved in the ipc code itself and must be in the application? Just wondering why these work arounds are needed and when they occur. The stale pipe code work around is at https://github.com/graemeg/lazarus/blob/upstream/components/chmhelp/packages/help/lhelpcontrol.pas So does anyone who uses IPC have to be aware of this and add the work around to all ipc code in all applications? Or it only happens in certain cases? It just makes me scared that there is this hack/fix needed. FPC now has this stale pipe detection included. The fix was added to the code lazarus uses until the next official version of FPC was released and went into the develop version of fpc in early 2012. At this point it could probably be removed form lazarus since there have been multiple releases of fpc since then. https://github.com/graemeg/freepascal/blob/master/packages/fcl-process/src/unix/simpleipc.inc#L97 https://github.com/graemeg/freepascal/commit/439236b9df1e952ad0fc1da42f05851dfea459ac Regards, Andrew Haines -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] LHelp or help systems that also work on..
On 11/19/2016 05:33 PM, Lars via Lazarus wrote: On Sat, November 19, 2016 3:24 pm, Lars wrote: On Fri, November 18, 2016 5:08 am, Andrew Haines via Lazarus wrote: lhelp uses IPC to communicate so it wouldn't be too bad to write a Delphi unit to control it. p.s. in addition to my last message, wouldn't SimpleIPC need to be ported to delphi then.. or at least some of it's mechanism. Would be neat if simpleipc was available in delphi so fpc programs could communicate to delphi programs. If only simpleipc was standardized and available in all languages ;-) Looking at the simpleipc unit I see TMsgHeader = Packed record Version : Byte; MsgType : TMessageType; MsgLen : Integer; end; I guess the message content, assuming any following data, is after MsgLen. This would be easy to implement. Regards, Andrew Haines -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] LHelp or help systems that also work on..
On 11/18/2016 06:36 AM, Lars via Lazarus wrote: Hi, Since I use both Lazarus and Delphi and never just use one or the other, is there any help system that works in both delphi and Lazarus? i.e. anyone port LHelp to delphi so delphi apps can have a similar help system? Or any other help systems that are portable between Laz and Delphi? I haven't studied much, but my guess is LHelp was specifically built for Lazarus and never considered Delphi, due to the name "L Help" which stands for maybe lazarus help. Assumptions here... lhelp uses IPC to communicate so it wouldn't be too bad to write a Delphi unit to control it. Compiling lhelp though is a fpc only job. https://github.com/graemeg/lazarus/blob/upstream/components/chmhelp/packages/help/lhelpcontrol.pas Regards, Andrew -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Mailinglist issues
On 09/24/2016 08:57 AM, Marc Weustink via Lazarus wrote: Hi all, As you might have noticed, there have been troubles with receiving mail from the lazarus list by gmail, yahoo and other subscribers. It is not a real change of policy, but mere a result of more and more subscribers using mail servers which sign (DKIM) and validate (DMARC) mail. As a result those messages bounce and the receiving subscriber might get unsubscribed. To improve our mailinglist, I've added DKIM support to our mailserver. To fully support it, the from header needs to be munged. So as a result, when you receive mailinglist mail, you don't receive it from "Marc Weustink", but from "Marc Weustink via LazTest " This is in effect for all lists served by lists.lazarus-ide.org Thanks, Marc Great thanks for fixing this! Now lets see if I get a copy of my email back. Regards, Andrew Haines -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus