Skip to content

Commit

Permalink
Add script to copy md as html
Browse files Browse the repository at this point in the history
  • Loading branch information
srid committed Jan 2, 2025
1 parent 036e5d2 commit 00ba1f8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions modules/home/all/terminal.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ in
# Publishing
asciinema
twitter-convert
copy-md-as-html

# Dev
gh
Expand Down
1 change: 1 addition & 0 deletions overlays/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ self: super: {
fuckport = self.callPackage "${packages}/fuckport.nix" { };
twitter-convert = self.callPackage "${packages}/twitter-convert" { };
sshuttle-via = self.callPackage "${packages}/sshuttle-via.nix" { };
copy-md-as-html = self.callPackage "${packages}/copy-md-as-html.nix" { };
ci = self.callPackage "${packages}/ci" { };
touchpr = self.callPackage "${packages}/touchpr" { };
actualism-app = inputs.actualism-app.packages.${self.system}.default;
Expand Down
16 changes: 16 additions & 0 deletions packages/copy-md-as-html.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{ writeShellApplication, wl-clipboard, pandoc, ... }:

writeShellApplication {
name = "copy-md-as-html";
meta.description = ''
Convert the given Markdown to HTML (using pandoc) and copy it to the clipboard.
This is useful for pasting Markdown content into rich text editors or GUI email clients (like Gmail).
'';
runtimeInputs = [ wl-clipboard pandoc ];
text = ''
set -x
pandoc "$1" -t html | wl-copy -t text/html
echo "Copied HTML to clipboard"
'';
}

0 comments on commit 00ba1f8

Please sign in to comment.