diff --git a/h-m-m b/h-m-m index 08732ec..5997efa 100755 --- a/h-m-m +++ b/h-m-m @@ -106,6 +106,8 @@ config($mm, 'active_node_color', "\033[38;5;0m\033[48;5;172m\033[1m"); config($mm, 'message_color', "\033[38;5;0m\033[48;5;141m\033[1m"); config($mm, 'doubt_color', "\033[38;5;168m"); +config($mm, 'post_export_command', ""); + config($mm, 'clipboard', "os"); config($mm, 'clipboard_file', "/tmp/h-m-m"); config($mm, 'clipboard_in_command', ""); @@ -1679,6 +1681,15 @@ function export_html(&$mm) message($mm, 'Exported as '.$mm['filename'].'.html'); copy_to_clipboard($mm, $mm['filename'].'.html'); + $filename = getenv('PWD').'/'.basename($mm['filename']).'.html'; + + if ($mm['post_export_command']!='') + { + message($mm, 'Running the "'.$mm['post_export_command'].'" command'); + exec(str_replace('%filename%', $filename, $mm['post_export_command']), $output, $result); + display($mm); + message($mm, 'Post-export command ended ('.$result.')'); + } } diff --git a/readme.md b/readme.md index 58e61f9..327065a 100644 --- a/readme.md +++ b/readme.md @@ -105,6 +105,7 @@ The following are the settings in h-m-m: clipboard_file = /tmp/h-m-m clipboard_in_command = "" clipboard_out_command = "" + post_export_command = "" The colors are ASCII escape codes. @@ -128,10 +129,15 @@ The normal `os` clipboard works fine for most users, but some users may need oth * `--clipboard=os` uses the global clipboard via xclip and similar tools. * `--clipboard=internal` uses an internal variable as the clipboard (won't exchange text with external applications). -* `--clipboard=file` uses `/tmp/h-m-m` by default, or aother file set by the `--clipboard_file=/path/filename` setting as the clipboard. +* `--clipboard=file` uses `/tmp/h-m-m` by default, or another file set by the `--clipboard_file=/path/filename` setting as the clipboard. * `--clipboard=command` uses `--clipboard_in_command="command %text%"` to send content to a shell command and `--clipboard_out_command="command"` to read content. +# Exporting + +You can export an HTML version of the map using the `x` key binding. This is useful for sending the file to someone who may not have h-m-m or a similar mind mapping application. To make the process easier, you can set a sell command to run after exporting the map; e.g., upload it to a server and copy the link to clipboard: `--post-export-command="upload.sh %filename% &>/dev/null"`. + + # Data format Mind maps are stored in plain text files (with `hmm` file extension by default) without metadata. The tree structure is represented by tab indentations; e.g.,