How to add support for literate languages? #2505
Unanswered
MangelMaxime
asked this question in
Q&A
Replies: 1 comment 5 replies
-
There are two separate issues here:
|
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I am looking into eleventy for my blog and documentation project. And I am missing a way to support F# literate file.
F# literate file, is a way to structure a file with documentation in mind. This is really useful as you can write your documentation page using a real F# file meaning that the compiler is checking that your code is valid etc.
Note: Here I am using F# as an example, but others language also support it
It can looks like that:
once converted into Markdown it looks like that:
I didn't find a way to pre-process the content of a file so I tried to write my own plugin for eleventy but ended up with 2 problems.
Problem 1: Front matter delimiters
In order, to write valid F# file I need to write the front matter using customs delimiters otherwise the compiler will give a syntax error.
I did that using
But this means that for all the files delimiters are now
(***
and***)
instead of---
. This gives a degraded user experience because syntax highlighting or extension doesn't work correctly because they don't detect the new front matter syntax.Plus, if I am using other literate languages I will probably need another type of limiter to be supported.
Is it possible to support multiple style of front matter delimiters?
Problem 2: Nunjucks instruction are not processed correctly
If I add lines like that in the
.fsx
filethen they are treated as raw content and not process as nunjucks instructions.
Is there a way to have nunjucks instructions to be process like done for the markdown files?
Here are the configuration I am using:
.eleventy.js
_11ty/plugins/fsharp-literate.js
Beta Was this translation helpful? Give feedback.
All reactions