fsprojects / FSharp.Formatting

F# tools for generating documentation (Markdown processor and F# code formatter)
https://fsprojects.github.io/FSharp.Formatting/
Other
462 stars 155 forks source link

Distinguish Code Snippets in multiple languages more clearly #487

Open Angr1st opened 5 years ago

Angr1st commented 5 years ago

I am currently trying to find a way to insert a label or something above the code snippet that contains the language name to make it clearer in what language the sample was written. Currently I don't really see a way to do it without modifying the css that FSharp.Formatting delivers or building this feature directly into FSharp.Formatting itself. If this would be something that is wanted I would appreciate it if someone could point me towards the right place to start with this. I have seen that you have started implementing potential prism.js support. #482 Maybe you would be interested in adding this language differentiation while you are at it.

tpetricek commented 5 years ago

I think you can mark language using either:

some normal text

```javascript
var a = {} + {};
```

Or using:

some normal text

    [lang=javascript]
    var a = {} + {}

The way this gets handled for different languages is not perfect, but the marking should work fine.

Angr1st commented 5 years ago

This only works within markdown files or also when using 'Literate programming'?

Angr1st commented 5 years ago

I am thinking of something like this example or this The F# and CSS label that are placed in the left upper corner.