cheats.rs
cheats.rs copied to clipboard
`json` or `text` output endpoint to allow for cli usage
This is something I was thinking about which would be nice if had json or text output endpoint similar to cheat.sh.
We can directly generate and host this as a static page as well, doesn't need any dynamic content to my knowledge. I will probably look into it once I have some time, or if someone else wants to pick this up would also be willing to help, if needed.
Let me know if this sounds like a good idea. Would be very useful for terminal users.
I could see this being useful.
- The actual entries should be generated from the existing tables, either by parsing Markdown (preferred), or HTML. Most information is encoded as a one-liner in some table
| {sigil or keyword } | { explanation } |under some section## XXX(number of columns and header level can vary), with the heading having a linkable HTML target. - Upstream links (the book, reference) and common symbols (e.g., "experimental", "outdated") could be extracted as tags.
- A JSON is probably more useful for other projects. The JSON should be generated offline when deploying, which means there needs to be some tool that runs with
deploy.sh - Alternatively, I could see an API-style interface work too extending the current
api.cheats.rsproviding Rusty syntax search (e.g., if you search for'bit might return an entry for'a), but this could easily get out of hand; like, why not re-implement or recycle a Rust grammar and do "part of speech" tagging (dunno how this is called in language design lingo) on snippets. I'm not really suggesting this; it's just an idea that was been floating through my head.