On 07/04/2023 10:29, Samuel Wales wrote:
when i use the superb org-capture extension in firefox, there is only
one icon, so any decisions about formatting have to be
one-size-fits-all at capture time in elisp.

Samuel, in your case, it is your requirement to have non-distracting single-click capture.

I admit that the feature is not implemented in browser add-ons.

A workaround is to define 2 capture template: for prose text and for code. Browser extension should not add template=x query parameter to org-protocol URI.

Extension may determine if the captured text pre-formatting, however there are some complications. Besides <pre> and <code> tags, there may be <div> and <span> elements with white-space: pre-wrap CSS property and similar. Selection may consist of several regions, each one with mix of regular and pre-formatted text.

Actually it is possible to convert selected text to Org markup. use

%(insert (shell-command-to-string "xclip -t text/html -o | pandoc -f html -t org -"))

in your capture template. Possible caveats: headers, especially <h1> may give undesired effect.


Reply via email to