PHP includes
Attached you the thing I'm trying to solve.
Right now I'm doing it via a script that loads the main file,
parses the <?php> tags and writes a new markdown file with
all in them.
Doing it right in Marked would be a bit nicer though :)
cheers,
Frank
- Markdown_PHP.zip 1.64 KB
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
Support Staff 1 Posted by Brett on 23 Dec, 2011 03:18 PM
I can add this as an option, but the catch is that you have to specify an absolute path to included files. This is because when Marked renders the text, it's doing it from memory, not from a file, so relative paths don't work.
To get it working with a custom processor, create a shell file called php2md.sh. I wrote this one to use Marked's internal version of MultiMarkdown, so you'll get the same results as Marked would show. Add this to the file:
Run
chmod a+x /path/to/php2md.sh
and add that path to Marked as a custom processor.Like I said, includes will have to have the full path name. I may be able to work around that in the future. I want to add a custom _pre_processor option as well, so you'd be able to use /usr/bin/php for that, and I want to try to pass environment variables to both processors. If I pull that off, I could pass the
__FILE__
location to the processor as well. All of that is in the future, though, and the above method will get you going for now. I tested it, it works (with absolute paths to includes).