#1 2022-07-11 14:24:17

tbo
Member
Registered: 2015-04-20
Posts: 353

HtmlEscapeMarkdown output does not match specification

The function HtmlEscapeMarkdown does not generate HTML code compatible with the specification. If one uses the specification on WikiPedia, here the links EN and more detailed DE, the following difference results:

  • Two spaces or more at the end of a line do not create a line break.

  • The # character does not create HTML headings.

  • No horizontal line is created by three or more hyphens, underscores or asterisks in a line.

You can easily check the output with the following source code:

const
  TEST_MARKDOWN: RawUtf8 =
      '## Header'#13#10
    + '---'#13#10
    + 'With best regards  '#13#10
    + 'Thomas';
var
  doc: RawUtf8;
begin
  doc := TEST_MARKDOWN;
  FileFromString(doc, 'TestRaw.txt');
  doc := HtmlEscapeMarkdown(doc);
  FileFromString(doc, 'TestMark.txt');

With best regards
Thomas

Offline

#2 2022-07-11 20:23:57

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,657
Website

Re: HtmlEscapeMarkdown output does not match specification

There are several markdown specs around, IIRC.

Any input to be more conformant is welcome.

Offline

#3 2022-07-12 07:31:51

sakura
Member
From: Germany
Registered: 2018-02-21
Posts: 239
Website

Re: HtmlEscapeMarkdown output does not match specification

The ones mentioned by tbo are standard of almost all. As a well known one, I'd suggest the github md style:
https://docs.github.com/en/get-started/ … ing-syntax

Regards,
Daniel

Offline

Board footer

Powered by FluxBB