FransBouma / DocNet

Your friendly static documentation generator, using markdown files to build the content.
http://fransbouma.github.io/DocNet/
248 stars 36 forks source link

Added support for @@include tag which will allow embedding html/markdown files from the '_partial' folder #31

Closed seemantr closed 8 years ago

seemantr commented 8 years ago

Done changes as per our discussion. Unfortunately this is not recursive in terms of include tags but that can be easily added at a later point of time. I have to send a new PR as I wanted to base it on your latest changes.

FransBouma commented 8 years ago

I think you can commit to a PR or update a PR, though I don't know specifics about that. (I often see 'commented on an outdated PR' in other repos, so it should be possible.

Anyway, on to your contribution: :) It's not a big deal it's not recursive, I'll add an issue that it should be updated.

What I'll do post merge though is change the default. I don't like the '_partial' default, so I'll change that. As that will break your own code, I'll add a docnet.json setting for configuring the include folder so you can keep using '_partial', which you likely chose to meet your own setup. :)

In my template engine in LLBLGen Pro I've implemented a recursive template include parser directive some years ago so it's not a big problem for me to implement that later on.

Thanks!

seemantr commented 8 years ago

Thanks @FransBouma. Will search Github manuals to understand how to update a PR :-). I also remember seeing people update a PR.

Renaming partial folder is not an issue for me. I will rename my folder. So, not a big deal. Feel free to do what ever you feel is the easiest option for you. Around recursive parsing, I can also push something in few weeks. To be honest I find C# and recursion to be very cumbersome as I code in F# most of the time where writing tail recursive code is amazing :).

FransBouma commented 8 years ago

The regexp is a bit of a problem though: @@include("foo.htm") also includes the "" in the matched filename. I assumed quotes were in order, as that's in general the intuitive way to go I think. It also matches directives given inside code blocks, which is a bit of a problem documenting this feature, but not really for many other situations.

I'll correct the quotes issue for now in the code directly (stripping them off) and will file an issue moving this to the span parser in markdowndeep :)

FransBouma commented 8 years ago

Et viola: http://fransbouma.github.io/DocNet/markdownextensions.htm#include-files :)