Closed yazeedobaid closed 1 year ago
Your first way is correct as far as I know, no highlighting. See for example F# core docs generated by fsdocs at this link for array, they don’t have highlighting.
Agreed though, the full highlighting features would be nice for API docs output.
Yes, that is what I think, the first way is the correct one. But I was playing with this to see what will work and what will not. Also thanks for sending the sample link.
I can propose a simple solution for this, so other syntax highlighting libraries like highlightjs and prismjs assume that code samples are in a pre
element with a code
element inside it. As follows:
<pre>
<code class="language-fsharp">
let files =
[ "build"; "docs" ]
|> List.map (fun n -> sprintf "%s.zip" n)
</code>
</pre>
Also, w3.org site has its samples written this way, so it seems this is the accessible way of writing code samples. I can send a PR to handle this in GenerateModel
class to insert a code
element in the pre
element and map the lang=fsharp
attribute on XML documentation to a class name for syntax highlighters to get. In this way, users can pull a syntax highlighter and it will work out of the box.
By this, the XML documentation will be kept with no changes. However, the output HTML will be as follows with changes highlighted.
<pre>
+ <code class="fsharp language-fsharp">
let files =
[ "build"; "docs" ]
|> List.map (fun n -> sprintf "%s.zip" n)
+ </code>
</pre>
I'm trying to generate API docs for a list of assemblies. The modules, types, and members from these assemblies have examples above them. The examples are written as follows:
The examples follow the format from F# Recommended XML doc extensions for F# documentation tooling RFC.
However, when I call the
dotnet fsdocs build
I got the following output in the generated HTML pages:On the other hand, if I enabled the
<UsesMarkdownComments>true</UsesMarkdownComments>
infsproj
files and re-write the example above in the following way:The resulting HTML will be like:
The HTML got syntax highlight and formatting.
This way as far as I know uses the Markdown parser, however, it violates the F# recommentation for XML documentation and IDE doesn't understand this format.
Is there a way to get syntax highlight and formatting using the first way? Or am I missing sth or an argument to
fsdocs
tool to enable it?Thanks