The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 4,224 other subscribers

Archive for December 2nd, 2021

Github markdown: red text

Posted by jpluimers on 2021/12/02

Github officially does not support coloured text, but with a small trick, you can get a few colours by including a diff file in the markdown.

I did it when I had to put on hold open source projects due to rectum cancer recovery, for instance [Wayback] this fritzcap diff added the [Wayback] text:

which [Wayback] rendered becomes a kind of red bulleted list:

I learned this trick via [Wayback] How to add color to Github’s file – Stack Overflow (thanks to [Wayback] revisions by [Wayback] craigmichaelmartin, [Wayback] Noam Manos and [Wayback] GalaxyCat105):

You can use the diff language tag to generate some colored text:

- text in red
+ text in green
! text in orange
# text in gray
@@ text in purple (and bold)@@

However, it adds it as a new line starting with either - + ! # or starts and ends with @@

enter image description here

This issue was raised in [Wayback] github markup #369, but they haven’t made any change in decision since then (2014).

By now there is a new issue, again with little progress: [Wayback] Color text in markdown · Issue #1440 · github/markup


Posted in Color (software development), Development, Lightweight markup language, MarkDown, Software Development | Leave a Comment »

LanguageTool – Online Grammar, Style & Spell Checker (English, German, Dutch, French, …)

Posted by jpluimers on 2021/12/02

Cool when writing texts in languages I don’t often write in, so I can read them better than I write them:

[Wayback/] LanguageTool – Online Grammar, Style & Spell Checker

It supports English (many variations, including US and UK English), German (Swiss and Austrian German too!), Dutch, and many other languages.


Posted in Development, LifeHacker, Power User, Software Development | Leave a Comment »

parsing – delphi – strip out all non standard text characers from string – Stack Overflow

Posted by jpluimers on 2021/12/02

From a while back a totally non-optimised code example by me (intentionally limiting to AnsiStr as it was about filtering ASCII, and UniCode has way many code points for the Latin script).

// For those who need a disclaimer: 
// This code is meant as a sample to show you how the basic check for non-ASCII characters goes
// It will give low performance with long strings that are called often.
// Use a TStringBuilder, or SetLength & Integer loop index to optimize.
// If you need really optimized code, pass this on to the FastCode people.
function StripNonAsciiExceptCRLF(const Value: AnsiString): AnsiString;
  AnsiCh: AnsiChar;
  for AnsiCh in Value do
    if (AnsiCh >= #32) and (AnsiCh <= #127) and (AnsiCh <> #13) and (AnsiCh <> #10) then
      Result := Result + AnsiCh;

and an optimised one by [WayBack] David Heffernan

function StrippedOfNonAscii(const s: string): string;
  i, Count: Integer;
  SetLength(Result, Length(s));
  Count := 0;
  for i := 1 to Length(s) do begin
    if ((s[i] >= #32) and (s[i] <= #127)) or (s[i] in [#10, #13]) then begin
      Result[Count] := s[i];
  SetLength(Result, Count);

Even when “trivial”, I usually do not prematurely optimise as optimised code is almost always less readable than non-optimised code.

Source: [Wayback] parsing – delphi – strip out all non standard text characers from string – Stack Overflow


Posted in Delphi, Development, Software Development | Leave a Comment »

%d bloggers like this: