sirthias / pegdown

A pure-Java Markdown processor based on a parboiled PEG parser supporting a number of extensions
http://pegdown.org
Apache License 2.0
1.29k stars 218 forks source link

Support markup to include the contents of a file #111

Open kminder opened 10 years ago

kminder commented 10 years ago

I'd like to be able to break a large document up into sections and then have a master document that imports all of the sections. The master document would then look something like this:

Title
=====

Table Of Contents
-----------------
* [Some Section](#Some+Section)

<<section.md>>
jirutka commented 10 years ago

I think that the cleanest solution for this is to implement a preprocessor that will merge the included sections with the main document and then pass to the Pegdown.

kminder commented 10 years ago

You are probably right. In fact this is exactly what I have done in a very naive way my project. I thought the idea might be interesting to be included in PegDown somehow. In particular a command line processor that used the preprocessor would be very useful in many situations. Most importantly some discussion/consensus about what the markup should be would be very valuable. I don't remember how I ended up settling on using << >> in my preprocessor. In any case it needs to mix well with the rest of the Markdown markup.