Sample Scripts and Working Directory
I am trying to create for myself a 'standard' perl script that enhances a few markdown features. I think a few others may like this as a template starter, so I am including it here, too.
I am running into a small problem, however. I would like to read a css file from the same connected working directory that my md text file is in. Right now, the script thinks it is running in '/\n'. I wonder if it would make sense to set a cwd to the directory in which the text file is found, but maybe there is a recommended work around...which is why I am asking as a question rather than a suggestion.
Since I am at it, could we pass the filename being processed somehow to the script?
- mdmore.zip 1.7 KB
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
1 Posted by ivo.welch on 05 Aug, 2024 08:42 PM
Sorry, use this improved version as perl template.
Support Staff 2 Posted by Brett on 05 Aug, 2024 09:02 PM
The custom processor is executing in a protected environment and CWD isn't an environment variable that can be set without actually changing directory. However, Marked provides multiple environment variables that can be used in scripts:
https://marked2app.com/help/Custom_Processor.html#environmentvariables
$MARKED_ORIGIN should be the one you need.
-Brett
On 5 Aug 2024, at 14:57, ivo.welch wrote:
3 Posted by ivo.welch on 06 Aug, 2024 01:03 AM
This is a much better way to do this. Thank you, B. Script uses it now, too.
Support Staff 4 Posted by Brett on 11 Aug, 2024 12:57 PM
Thanks for sharing!
Brett closed this discussion on 11 Aug, 2024 12:57 PM.