PHP includes's Avatar

23 Dec, 2011 02:52 PM

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 :)


  1. Support Staff 1 Posted by Brett on 23 Dec, 2011 03:18 PM

    Brett's Avatar

    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 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:

     cat | /usr/bin/php | /Applications/

    Run chmod a+x /path/to/ 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).

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Already uploaded files

  • 1.64 KB

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? 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