zimbatm/mdsh

block formatting syntax

zimbatm opened this issue · 1 comments

It would be nice if the outputted blocks could also include the highlighting format.

Where in the following block do we give the syntax?

`[$ code.rb](code.rb)`

So that it outputs:

```ruby
require "pp"

pp ({ foo: 3 })
```

It's difficult to find a format that is natural to write and read. The problem is that it adds a bit too much redundancy to the rendered output.

A few options that come to mind:

1: apprend as <lang> to the directive. Eg:

`$ curl ifconfig.co/json` as json
[$ code.rb](code.rb) as ruby

2: for links, use the file extension as a detection heuristic

For example all files ending in .rb could be classified as ruby syntax. This means maintaining a mime file extension map to highlight name. If the heuristic is broken, which will happen in some case, there would be no way of overriding the default.

3: use mime magic detection

Similar to the file ending heuristic, this is a heuristic that needs to be maintained.