From 2af2b9a914ef930900f75647f8c977ef3ecd0a9b Mon Sep 17 00:00:00 2001 From: work Date: Tue, 9 Jan 2024 14:47:08 +0300 Subject: [PATCH] Markdown : Add Gitea renderer. --- .config/bash/module/Markdown.sh | 15 +++++++++++++++ .doc/Bash.md | 6 ++++++ 2 files changed, 21 insertions(+) create mode 100644 .config/bash/module/Markdown.sh diff --git a/.config/bash/module/Markdown.sh b/.config/bash/module/Markdown.sh new file mode 100644 index 0000000..7b9c120 --- /dev/null +++ b/.config/bash/module/Markdown.sh @@ -0,0 +1,15 @@ +# Render markdown in browser using Gitea API. Because I want consistency with Gitea web render. +# Works only inside LAN. +# Usage: markdown_render +function markdown_render() { + local IFS=$'\n' + local file="${1}" + local render="markdown_render.html" + + if [[ "${file}" = "" ]]; then + help markdown_render + return 2 + fi + + curl -X POST https://git.voronind.com/markdown -d "$(cat ${file})" > "${render}" && o "${render}" && sleep 2 && rm "${render}" +} diff --git a/.doc/Bash.md b/.doc/Bash.md index 432742f..fe86d51 100644 --- a/.doc/Bash.md +++ b/.doc/Bash.md @@ -220,6 +220,12 @@ Command|Description `la [DIRS]`|List all files in dirs, incl. hidden files. Current dir by default. `lla [DIRS]`|List all files in dirs, incl. hidden files, sorted by mtime. Current dir by default. +## Markdown. + +Command|Description +---|--- +`markdown_render `|Render markdown in browser using Gitea API. Because I want consistency with Gitea web render. Works only inside LAN. + ## Name. Command|Description