granicz / SiteFi

A simple WebSharper-based static blog generator with markdown articles.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

F# syntax highlighting not working

FoggyFinder opened this issue · comments

One of the listed key features is "Syntax highlighting for F# code blocks"
But when I follow instructions from the ReadMe the code looks like this:

_sample

So, there is no highlighting for code. Have I missed something?

You need to use fsharp as your format specifier in your triple-backtick block, so start your block with ```fsharp for the F# syntax highlighting to kick in.

That's understandable :-)

I attached screenshot from the default post of the repo:
Using JS.Alert

That snippet does contain fsharp tag.

Again, I just followed instructions from the ReadMe. Nothing more.

The html shows that code are in pre/code tag:

<pre><code class="language-fsharp">

and there are scripts:

<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.14.2/highlight.min.js" type="text/javascript" charset="UTF-8"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.14.2/languages/fsharp.min.js" type="text/javascript" charset="UTF-8"></script>

Additional info:

There is no such problem if I use dotnet run

Can you give me the full URL you are viewing in the browser? And also compare that to:

  • If it's localhost:56000, then you are running Website from Visual Studio
  • If it's localhost:56001, then you are running .\start.cmd from the root
  • If it's localhost:5000, then you are running Hosted from Visual Studio

Either way, your page should also contain this script:

  <script src="/js/Client.js"></script>

... which contains the transpiled code from Client, which in turn triggers syntax highlighting.

sure, it is

http://localhost:56001/blog/2015-08-04-IntroducingTryWebSharper.html

".tools/dotnet-serve.exe" -d build -p:56001 --default-extensions:.html -a 0.0.0.0
Starting server, serving build
Using default extensions .html
Listening on:
  http://localhost:56001

Odd. I had removed build folder and now everything is fine.

Anyway seems like dotnet-serve doesn't work correctly. I switched to the master branch and it is still shows page from the other branch. Well, maybe it's my fault and I've done something wrong but still unexpected.

Anyway, I'm closing the issue since I'm unable to reproduce.