git2codeblock

Crates.iogit2codeblock
lib.rsgit2codeblock
version0.1.0
sourcesrc
created_at2021-08-25 14:09:32.869058
updated_at2021-08-25 14:09:32.869058
descriptionTurn GitHub and GitLab codesnippet URLs into Markdown codeblocks
homepagehttps://github.com/ewpratten/git2codeblock
repositoryhttps://github.com/ewpratten/git2codeblock
max_upload_size
id442169
size47,189
Evan Pratten (ewpratten)

documentation

https://docs.rs/git2codeblock

README

git2codeblock

Crates.io Docs.rs Build Clippy Audit

git2codeblock is a crate that converts git URLs into codeblocks. This is mainly for use in one of my Discord bots, but is written to be used anywhere.

Example

Given the url: https://gitlab.com/ewpratten/DeepSpace/-/blob/master/CODEOWNERS#L2, git2codeblock will realize that this is GitLab, correctly process the file, and return a Markdown fenced codeblock.

let url = "https://gitlab.com/ewpratten/DeepSpace/-/blob/master/CODEOWNERS#L2";
let codeblock = git2codeblock::extract_codeblock(url).await.unwrap();
assert_eq!(codeblock, "```\n*       @ewpratten @slownie @johnlownie @LordMichaelmort @awpratten\n```");
Commit count: 2

cargo fmt