Frank,

The chances are, Marked is piping the source document as a string to
asciidoc (so it reads from STDIN). In this mode, the asciidoc command will
only attempt to resolve include files from the current working directory of
the asciidoc command.

There are a few ways to solve this problem.

Option A ::
You can switch the current working directory to the directory of your
document using a shell script (or commandline chain) that wraps the
asciidoc command. You would need some way for Marked to pass the directory
of the document so the script knows where it needs to switch.
Option B ::
You can set the absolute include directory as an attribute in your AsciiDoc
document, then prefix all include paths with this attribute.
For example:
+
[source,asciidoc]
----
= Document Title
:includedir: /path/to/document/

include::{includedir}myfile.txt[]
----
+
Of course, you can override the includedir attribute from the commandline
when you process the document in a different context. Consider the setting
in the document as the fallback.

Option C ::
You can use Asciidoctor, which allows you to set the base directory from
the commandline. I'm not sure how to get the document directory from
Marked, so let's just assume for now that you have to hard code it. You
would add the following option: `-B /path/to/documents`
+
Asciidoctor has the benefit that it's about 40x as fast as AsciiDoc. For
instance, the 17,000 line (3,750 blocks) Enterprise Web Book from O'Reilly
renders to HTML5 in 0.85 seconds on my laptop :)

Good luck!

-Dan




On Fri, Aug 23, 2013 at 2:03 AM, Frank Blome <[email protected]>wrote:

> Hi,
>
> I just started with Marked, so your hint was excellent. It works even
> faster than you described (on a recent MacBook Pro I'll get half the
> times). But my problem is not the timing.
>
> The processing stops right away at the very first "include::myfile.txt[]".
> Is there any argument or so I can do to make this work?
>
> Thanks,
> Frank
>
> Am Samstag, 20. Oktober 2012 11:56:14 UTC+2 schrieb Shawn Giese:
>>
>> Marked is an application to preview Markdown syntax in HTML.  There are
>> additional utilities such as link validation, readability statistics,
>> scroll to first edit, and CSS switching.  Marked also supports custom
>> processors (that can send HTML to STDOUT) so I could configure AsciiDoc to
>> create the HTML from my AsciiDoc files.
>>
>> In the behavior settings of Marked I completed the following steps:
>>
>>    - enabled Custom Markdown Processor
>>    - entered "opt/local/bin/asciidoc" as the path to asciidoc (I used
>>    MacPorts to install AsciiDoc)
>>    - entered "--backend html5 -" as args (the - at the end sends the
>>    output as STDOUT)
>>
>>
>> Now, when I save updates to an AsciiDoc file from any editor, Marked will
>> preview my document for me.  This is a great way to see Graphviz charts and
>> pycharts however external files and macros need additional configuration
>> (for example if you are loading a CSV file, creating a QR Code or running
>> an external script from the AsciiDoc file.)
>>
>> This sends the current document to STDIN and displays the generated HTML
>> as STDOUT.  Admittedly, a long document can take a long time to preview,
>> for example a 10'000 word document takes nearly 20 seconds to display in
>> the Marked preview.
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "asciidoc" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/asciidoc.
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Dan Allen | http://google.com/profiles/dan.j.allen

-- 
You received this message because you are subscribed to the Google Groups 
"asciidoc" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/asciidoc.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to