rnorth / mkdocs-codeinclude-plugin

MIT License
14 stars 8 forks source link

manually specify language for syntax highlighting to override auto detection #29

Open vlabella opened 2 years ago

vlabella commented 2 years ago

Is it possible to manually specify the programming language as one can do in mkdoc markdown file like

```my_language
this is my special obscure programming
language that is not recognized by highlightjs out of the box.
So I wrote my own language extension for it which works great
but auto detect does not work for some reason
```

maybe the syntax could be

<!--codeinclude-->
[Human readable title for snippet](./hello_world.my_language){my_language}
<!--/codeinclude-->
fundthmcalculus commented 1 year ago

Yes you can. It looks like this:

=== "TypeScript"
    <!--codeinclude-->
    ```typescript
    [{block_name}](../../../web/test/{service_file_name}.spec.ts) inside_block:{block_name}
<!--/codeinclude-->

=== "C#"

```csharp
[{block_name}](../../../dotnet/Tests/{service_file_name}.cs) inside_block:{block_name}
```
<!--/codeinclude-->

=== "Dart"

```dart
[{block_name}](../../../dart/example/{service_file_name}.dart) inside_block:{block_name}
```
<!--/codeinclude-->