feat: markdown to html script
- add binary: md2html - nvf: add snack nvim
This commit is contained in:
parent
16da0a0a4d
commit
d7cf0baf67
10 changed files with 246 additions and 199 deletions
23
home/scripts/md2html.nix
Normal file
23
home/scripts/md2html.nix
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{ pkgs, ... }:
|
||||
let
|
||||
cssStyle = pkgs.fetchurl {
|
||||
url = "https://raw.githubusercontent.com/xz/new.css/refs/heads/master/new.css";
|
||||
hash = "sha256-Xd3AMZOeThsrupQusSLjqv3hbNmcpeTms0ieI9nyxOk=";
|
||||
};
|
||||
in
|
||||
pkgs.writeShellScriptBin "md2html" ''
|
||||
set -e
|
||||
|
||||
INPUT="$1"
|
||||
shift
|
||||
|
||||
BASENAME="''\${INPUT%.*}"
|
||||
HTML_TEMP="''\${BASENAME}.html"
|
||||
PDF_OUTPUT="''\${BASENAME}.pdf"
|
||||
|
||||
${pkgs.pandoc}/bin/pandoc "$INPUT" -s \
|
||||
--to=html5 --embed-resources \
|
||||
--css=${cssStyle} -o "$HTML_TEMP" "$@"
|
||||
|
||||
echo "generated: $HTML_TEMP"
|
||||
''
|
||||
Loading…
Add table
Add a link
Reference in a new issue