Thank you, Fletcher. Putting the script into the Scripts folder
works without side effects. :)
I also found that a reduced, stdin/stdout-ish version of the filter
(without cd "$(dirname "$BB_DOC_PATH")" and an -o target file), i.e.
pandoc --from markdown --to html --toc --standalone "${BB_DOC_PATH}"
… returns Pandoc’s output to the current window, allowing for in-place
conversion. Nice!
[email protected] schrieb am Samstag, 4. Februar 2023 um 17:42:27 UTC+1:
> The text filter replaces the content of the BBEdit document with the
> output of the script which is empty.
>
> You can put the same script in the Scripts folder and run it from there
> without this happening. You need to add a #!/bin/sh or similar line to the
> top.
>
> You could also probably just echo the original file back to BBEdit at the
> end of the script.
>
> cat "$(BB_DOC_PATH)"
>
> Hope this helps,
>
> [fletcher]
>
>
> On Feb 4, 2023, at 3:27 AM, Martin Post <[email protected]> wrote:
>
> If I apply this Text filter (pandoc.sh):
>
> cd "$(dirname "$BB_DOC_PATH")";
> pandoc --from markdown --to html --standalone "${BB_DOC_PATH}" -o
> "${BB_DOC_PATH%%.*}".html
>
> …to a text file (with nothing selected), the converted HTML file will be
> stored as expected – but the content of the open text file will be deleted.
> This is undoable, but why does it happen / how can it be avoided?
>
> (I have used similar scripts as *Preview* filters for years, where this
> problem didn’t occur.)
>
> Thank you.
>
> --
> This is the BBEdit Talk public discussion group. If you have a feature
> request or need technical support, please email "[email protected]"
> rather than posting here. Follow @bbedit on Twitter: <
> https://twitter.com/bbedit>
> ---
> You received this message because you are subscribed to the Google Groups
> "BBEdit Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/bbedit/54c684f0-c7f3-4d05-85d9-e9e0b78ed732n%40googlegroups.com
>
> <https://groups.google.com/d/msgid/bbedit/54c684f0-c7f3-4d05-85d9-e9e0b78ed732n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>
>
--
This is the BBEdit Talk public discussion group. If you have a feature request
or need technical support, please email "[email protected]" rather than
posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/bbedit/688d3ea1-0c58-4451-a7d1-61ea19ee182an%40googlegroups.com.