Crates.io | git2codeblock |
lib.rs | git2codeblock |
version | 0.1.0 |
source | src |
created_at | 2021-08-25 14:09:32.869058 |
updated_at | 2021-08-25 14:09:32.869058 |
description | Turn GitHub and GitLab codesnippet URLs into Markdown codeblocks |
homepage | https://github.com/ewpratten/git2codeblock |
repository | https://github.com/ewpratten/git2codeblock |
max_upload_size | |
id | 442169 |
size | 47,189 |
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.
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```");