Closed dburriss closed 1 year ago
There is no yaml syntax highlighter (people have proposed adding support for things like highlight.js, but it isn't added yet).
Not sure if this is close to what you want, but here's some relatively simple options below. If this doesn't work, you could look more at the embedding output examples here, which show how to make a custom formatter.
code:
(**
Some markdown text
*)
(***hide***)
let md = "
apiVersion: apps/v1
kind: Deployment
"
printfn "%s" md
(***include-output ***)
(***hide***)
let makeMd text = $"""
<pre class="fssnip highlighted">
<code lang="fsharp">
{text}
</code>
</pre>
"""
makeMd md
(***include-it-raw***)
(**
Some more text
[yaml]
apiVersion: apps/v1
kind: Deployment
*)
(***hide***)
let md =
["apiVersion: apps/v1"
"kind: Deployment"]
md
|> List.map (fun line -> sprintf "<span>%s</span><br>" line)
|> String.concat ""
(***include-it-raw ***)
Thanks @nhirschey I reckon this will get me what I want.
I am trying to output the content of a variable as markdown. As an example:
Current
Then for documentation I can output styled yaml instead of a "string" as seen below.
If this is not possible, I am more than happy to try to pick it up as a feature if maintainers think it is worth adding. Maybe something like this:
Desired (or similar)