Skip to content

Commit c1e1c1d

Browse files
ver. 1.2.0
- Fixed const parameters
1 parent 89d8106 commit c1e1c1d

10 files changed

+46
-35
lines changed

README.htm

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
</style>
3232
<h1>Markdown Processor <a href="https://opensource.org/licenses/Apache-2.0"><img src="https://img.shields.io/badge/License-Apache%202.0-yellowgreen.svg" alt="License"/></a></h1>
3333
<p>A Markdown Processor Library for Delphi, to process/convert markdown files to HTML.</p>
34-
<p><strong>Latest Version 1.1.0 - 16 Dec 2024</strong></p>
34+
<p><strong>Latest Version 1.2.0 - 08 Apr 2025</strong></p>
3535
<p><mark></mark><mark></mark><mark></mark></p>
3636
<h2>Basic Information</h2>
3737
<p>This is a Pascal (Delphi) library that processes markdown to HTML.
@@ -57,9 +57,9 @@ <h2>Using the Library with Delphi</h2>
5757
</code></pre>
5858
<p>Note: you should only set this to true if you <em>need</em> to - active content can be a significant safety/security issue.<br /></p>
5959
<p>Generate HTML fragments from Markdown content:</p>
60-
<pre><code class="Pascal"> html := md.process(markdown);
60+
<pre><code class="Pascal"> html := md.process(markdown);
6161
</code></pre>
62-
<p>Note that the HTML returned is an HTML fragment, not a full HTML page.<br /></p>
62+
<p>Note that the HTML returned is an HTML fragment, not a full HTML page.</p>
6363
<p>Do not forget to dispose of the object after the use:</p>
6464
<pre><code class="Pascal"> md.free
6565
</code></pre>
@@ -77,11 +77,15 @@ <h2>Examples</h2>
7777
<p>An integrated help system based on files in Markdown format (and also html), for Delphi applications:</p>
7878
<p><img src="./images/ContentPage.png" alt="Markdown HelpViewer"/></p>
7979
<h2>Release Notes</h2>
80+
<p>08 Apr 2025: ver. 1.2.0</p>
81+
<ul>
82+
<li>Fixed const parameters</li>
83+
</ul>
8084
<p>16 Dec 2024: ver. 1.1.0</p>
8185
<ul>
8286
<li>Updated Demo for FireMonkey</li>
8387
</ul>
84-
<p>11 Oct 2023: ver. 1.0.0</p>
88+
<p>22 Oct 2023: ver. 1.0.0</p>
8589
<ul>
8690
<li>Project forked from FPC-markdown by Miguel A. Risco-Castillo</li>
8791
<li>Removed unused Dialect mdAsciiDoc</li>

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
A Markdown Processor Library for Delphi, to process/convert markdown files to HTML.
44

5-
**Latest Version 1.1.0 - 16 Dec 2024**
5+
**Latest Version 1.2.0 - 08 Apr 2025**
66

77
============
88

@@ -48,11 +48,11 @@ Note: you should only set this to true if you *need* to - active content can be
4848
Generate HTML fragments from Markdown content:
4949

5050
```Pascal
51-
html := md.process(markdown);
51+
html := md.process(markdown);
5252
```
53-
54-
Note that the HTML returned is an HTML fragment, not a full HTML page.
55-
53+
54+
Note that the HTML returned is an HTML fragment, not a full HTML page.
55+
5656
Do not forget to dispose of the object after the use:
5757

5858
```Pascal
@@ -80,6 +80,9 @@ An integrated help system based on files in Markdown format (and also html), for
8080

8181
## Release Notes ##
8282

83+
08 Apr 2025: ver. 1.2.0
84+
- Fixed const parameters
85+
8386
16 Dec 2024: ver. 1.1.0
8487
- Updated Demo for FireMonkey
8588

TestFile/MarkDown Support Test.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
Markdown support test
1+
Markdown support test
22
=====================
33

44
![Markdown logo](markdownlogo.png)
55

66
This page is a small demonstration of Markdown support.
77

8+
The file is encoded in UTF-8 format with BOM (this is a UTF-8 symbol: €)
9+
810
<https://www.markdownguide.org>
911

1012
Referenced link: From [CommonMark]:
@@ -68,7 +70,7 @@ end;
6870
It is possible to use the [Google Chart API] using `TeX` language,
6971
but the translated formula can only to be seen using a browser,
7072
for insert a formula using `TeX` enclose the code between `$`
71-
without `spaces`:
73+
without `spaces`:
7274

7375
Quadratic formula |Zeta formula
7476
---------------------------|-----------------------------

source/MarkdownCommonMark.pas

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{ MarkDown Processor }
44
{ Delphi version of FPC-markdown by Miguel A. Risco-Castillo }
55
{ }
6-
{ Copyright (c) 2022-2024 (Ethea S.r.l.) }
6+
{ Copyright (c) 2022-2025 (Ethea S.r.l.) }
77
{ Author: Carlo Barazzetta }
88
{ }
99
{ https://github.com/EtheaDev/MarkdownProcessor }
@@ -71,7 +71,7 @@ TMarkdownCommonMark = class(TMarkdownDaringFireball)
7171
public
7272
Constructor Create;
7373
Destructor Destroy; override;
74-
function process(source: String): String; override;
74+
function Process(const ASource: string): string; override;
7575
end;
7676

7777
implementation
@@ -90,9 +90,9 @@ destructor TMarkdownCommonMark.Destroy;
9090
inherited;
9191
end;
9292

93-
function TMarkdownCommonMark.process(source: String): String;
93+
function TMarkdownCommonMark.Process(const ASource: string): string;
9494
begin
95-
result:=inherited process(source);
95+
result := inherited Process(ASource);
9696
end;
9797

9898

source/MarkdownDaringFireball.pas

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{ MarkDown Processor }
44
{ Delphi version of FPC-markdown by Miguel A. Risco-Castillo }
55
{ }
6-
{ Copyright (c) 2022-2024 (Ethea S.r.l.) }
6+
{ Copyright (c) 2022-2025 (Ethea S.r.l.) }
77
{ Author: Carlo Barazzetta }
88
{ }
99
{ https://github.com/EtheaDev/MarkdownProcessor }
@@ -69,7 +69,7 @@ TMarkdownDaringFireball = class(TMarkdownProcessor)
6969
public
7070
Constructor Create;
7171
Destructor Destroy; override;
72-
function process(source: String): String; override;
72+
function Process(const ASource: string): string; override;
7373
end;
7474

7575
implementation
@@ -115,14 +115,14 @@ procedure TMarkdownDaringFireball.initListBlock(root: TBlock);
115115
root.split(root.lineTail).type_ := btLIST_ITEM;
116116
end;
117117

118-
function TMarkdownDaringFireball.process(source: String): String;
118+
function TMarkdownDaringFireball.Process(const ASource: string): string;
119119
var
120120
out_: TStringBuilder;
121121
parent, block: TBlock;
122122
rdr : TMarkdownReader;
123123
begin
124124
FuseExtensions := Config.isDialect([mdTxtMark,mdCommonMark]);
125-
rdr := TMarkdownReader.Create(source);
125+
rdr := TMarkdownReader.Create(ASource);
126126
try
127127
out_ := TStringBuilder.Create;
128128
try

source/MarkdownMathCode.pas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{ MarkDown Processor }
44
{ Delphi version of FPC-markdown by Miguel A. Risco-Castillo }
55
{ }
6-
{ Copyright (c) 2022-2024 (Ethea S.r.l.) }
6+
{ Copyright (c) 2022-2025 (Ethea S.r.l.) }
77
{ Author: Carlo Barazzetta }
88
{ }
99
{ https://github.com/EtheaDev/MarkdownProcessor }

source/MarkdownProcessor.pas

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{ MarkDown Processor }
44
{ Delphi version of FPC-markdown by Miguel A. Risco-Castillo }
55
{ }
6-
{ Copyright (c) 2022-2024 (Ethea S.r.l.) }
6+
{ Copyright (c) 2022-2025 (Ethea S.r.l.) }
77
{ Author: Carlo Barazzetta }
88
{ }
99
{ https://github.com/EtheaDev/MarkdownProcessor }
@@ -72,8 +72,9 @@ interface
7272
procedure SetAllowUnSafe(const Value: boolean); virtual; abstract;
7373
public
7474
class function CreateDialect(dialect : TMarkdownProcessorDialect) : TMarkdownProcessor;
75-
function process(source : String) : String; virtual; abstract;
76-
function processFile(source: String; Encoding: TEncoding = nil): String; virtual;
75+
function Process(const ASource : string) : string; virtual; abstract;
76+
function ProcessFile(const AFileName: TFileName;
77+
const AEncoding: TEncoding = nil): string; virtual;
7778
property config: TConfiguration read FConfig write FConfig;
7879
// when AllowUnsafe = true, then the processor can create scripts etc.
7980
property AllowUnsafe : boolean read GetAllowUnSafe write SetAllowUnSafe;
@@ -100,17 +101,18 @@ class function TMarkdownProcessor.CreateDialect(dialect: TMarkdownProcessorDiale
100101
end;
101102
end;
102103

103-
function TMarkdownProcessor.processFile(source: String; Encoding: TEncoding): String;
104+
function TMarkdownProcessor.ProcessFile(const AFileName: TFileName;
105+
const AEncoding: TEncoding): string;
104106
var
105-
markdown:TStringList;
107+
LMarkdown: TStringList;
106108
begin
107109
result:='';
108-
markdown := TStringList.Create;
110+
LMarkdown := TStringList.Create;
109111
try
110-
markdown.LoadFromFile(source, Encoding);
111-
result:=process(markdown.Text);
112+
LMarkdown.LoadFromFile(AFileName, AEncoding);
113+
result:=process(LMarkdown.Text);
112114
finally
113-
if assigned(markdown) then markdown.Free;
115+
if assigned(LMarkdown) then Lmarkdown.Free;
114116
end;
115117
end;
116118

source/MarkdownTables.pas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{ MarkDown Processor }
44
{ Delphi version of FPC-markdown by Miguel A. Risco-Castillo }
55
{ }
6-
{ Copyright (c) 2022-2024 (Ethea S.r.l.) }
6+
{ Copyright (c) 2022-2025 (Ethea S.r.l.) }
77
{ Author: Carlo Barazzetta }
88
{ }
99
{ https://github.com/EtheaDev/MarkdownProcessor }

source/MarkdownTxtMark.pas

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{ MarkDown Processor }
44
{ Delphi version of FPC-markdown by Miguel A. Risco-Castillo }
55
{ }
6-
{ Copyright (c) 2022-2024 (Ethea S.r.l.) }
6+
{ Copyright (c) 2022-2025 (Ethea S.r.l.) }
77
{ Author: Carlo Barazzetta }
88
{ }
99
{ https://github.com/EtheaDev/MarkdownProcessor }
@@ -42,7 +42,7 @@ TMarkdownTxtMark = class(TMarkdownDaringFireball)
4242
public
4343
Constructor Create;
4444
Destructor Destroy; override;
45-
function process(source: String): String; override;
45+
function Process(const ASource: string): string; override;
4646
end;
4747

4848
implementation
@@ -62,9 +62,9 @@ destructor TMarkdownTxtMark.Destroy;
6262
inherited;
6363
end;
6464

65-
function TMarkdownTxtMark.process(source: String): String;
65+
function TMarkdownTxtMark.Process(const ASource: string): string;
6666
begin
67-
result:=inherited process(source);
67+
result := inherited Process(ASource);
6868
end;
6969

7070

source/MarkdownUtils.pas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{ MarkDown Processor }
44
{ Delphi version of FPC-markdown by Miguel A. Risco-Castillo }
55
{ }
6-
{ Copyright (c) 2022-2024 (Ethea S.r.l.) }
6+
{ Copyright (c) 2022-2025 (Ethea S.r.l.) }
77
{ Author: Carlo Barazzetta }
88
{ }
99
{ https://github.com/EtheaDev/MarkdownProcessor }

0 commit comments

Comments
 (0)