@@ -12,6 +12,12 @@ namespace Sisk.Documenting.Html;
12
12
/// </summary>
13
13
public class HtmlDocumentationExporter : IApiDocumentationExporter {
14
14
15
+ /// <summary>
16
+ /// Creates an new instance of the <see cref="HtmlDocumentationExporter"/> class.
17
+ /// </summary>
18
+ public HtmlDocumentationExporter ( ) {
19
+ }
20
+
15
21
/// <summary>
16
22
/// Gets or sets the title of the HTML page.
17
23
/// </summary>
@@ -63,23 +69,29 @@ public class HtmlDocumentationExporter : IApiDocumentationExporter {
63
69
public string FormatRequiredText { get ; set ; } = "Required" ;
64
70
65
71
/// <summary>
66
- /// Gets or sets an optional object to append to the footer
67
- /// of the generated page.
72
+ /// Gets or sets an optional object to append after the generated contents, right at the end of the <c><main></c>
73
+ /// tag of the generated page.
68
74
/// </summary>
69
75
public object ? Footer { get ; set ; }
70
76
71
77
/// <summary>
72
- /// Gets or sets an optional object to append to the header
73
- /// of the generated page.
78
+ /// Gets or sets an optional object to append after the main title, at the beginning of the <c><main></c>
79
+ /// tag of the generated page.
74
80
/// </summary>
75
81
public object ? Header { get ; set ; }
76
82
83
+ /// <summary>
84
+ /// Gets or sets an optional object to append inside the <c><head></c>
85
+ /// tag of the generated page.
86
+ /// </summary>
87
+ public object ? Head { get ; set ; }
88
+
77
89
/// <summary>
78
90
/// Writes the main title of the API documentation.
79
91
/// </summary>
80
92
/// <param name="documentation">The API documentation to write the title for.</param>
81
93
/// <returns>The HTML element representing the main title.</returns>
82
- protected virtual HtmlElement WriteMainTitle ( ApiDocumentation documentation ) {
94
+ protected virtual HtmlElement ? WriteMainTitle ( ApiDocumentation documentation ) {
83
95
return HtmlElement . Fragment ( fragment => {
84
96
fragment += new HtmlElement ( "h1" , documentation . ApplicationName ?? "Application name" )
85
97
. WithClass ( "app-title" ) ;
@@ -108,6 +120,8 @@ protected virtual HtmlElement WriteMainTitle ( ApiDocumentation documentation )
108
120
details += new HtmlElement ( "h3" , endpoint . Name ) ;
109
121
details += this . CreateParagraphs ( endpoint . Description ) ;
110
122
123
+ details += this . CreateCodeBlock ( $ "{ endpoint . RouteMethod . ToString ( ) . ToUpper ( ) } { endpoint . Path } ", null ) ;
124
+
111
125
if ( endpoint . Headers . Length > 0 ) {
112
126
details += new HtmlElement ( "div" , div => {
113
127
div += new HtmlElement ( "p" , this . FormatEndpointHeaders ) ;
@@ -251,15 +265,11 @@ protected virtual HtmlElement WriteMainTitle ( ApiDocumentation documentation )
251
265
/// <param name="text">The text to display in the paragraphs, or null for no paragraphs.</param>
252
266
/// <returns>The HTML element representing the paragraphs, or null if no text is provided.</returns>
253
267
[ return : NotNullIfNotNull ( nameof ( text ) ) ]
254
- protected virtual HtmlElement ? CreateParagraphs ( string ? text ) {
268
+ protected virtual object ? CreateParagraphs ( string ? text ) {
255
269
if ( text is null )
256
270
return null ;
257
271
258
- return HtmlElement . Fragment ( fragment => {
259
- foreach ( var s in text . Split ( '\n ' , StringSplitOptions . RemoveEmptyEntries ) ) {
260
- fragment += new HtmlElement ( "p" , s ) ;
261
- }
262
- } ) ;
272
+ return new MarkdownText ( text ) ;
263
273
}
264
274
265
275
/// <summary>
0 commit comments