doctavious / snippext

Snippext extracts snippets from source files and merges them into your documentation.
MIT License
0 stars 0 forks source link

Autodetect Snippet Language #17

Closed seancarroll closed 1 year ago

seancarroll commented 1 year ago

Currently if a user wants to include a source language identifier in a code block e.g.

```rust

Users need to add a `lang` attribute in the source snippet e.g.

snippet::start main { "lang": "rust" }



We should autodetect source based on source file the snippet is in. Users can override the autodetected source by providing the `lang` attribute. We could also make autodetect configurable and allow users to disable it if they need to.
seancarroll commented 1 year ago

Did some initial research and found hyperpolygot a rust port of the ruby gem linguist. Going to take a crack at using hyperpolyglot to do the language detection.