Package: mdtogh
MotivationBasically, You may want to convert md files into Html looks exactly like github does.Maybe you would trypandoc, but html it generates looksnotvery well.So, I start writing this small tool, inspired bygripFeaturesmdtogh canconvertyour md files into html files like github does with features belows:toc supportcustom toc(use one file to be toc)index.html for your booknext/prev files linkfile regexp to select your md filesfix relative link(ie.<a href=”01.md”></a>=><a href=”01.html”></a>)custom templateoffline rendererproxy support(respect https_proxy environment variable)cache supportdemoI’ve generate a book written by julycoding:The-Art-Of-Programming-By-July.Demo link:taop.marchtea.comYou can check on that.InstallationFrompypi$pipinstallmdtoghAlso, you can clone repo & install with setup.py.$gitclonehttps://github.com/marchtea/md_to_github_html.git$cdmd_to_github_html$pythonsetup.pyinstallMaybe you will need add sudoUsageGenerate one or more files$cdmdfiles$mdtogh01.md02.md03.mdGenerate all md files in current directory$cdmdfiles$mdtoghGenerate md files in other directory$mdtogh../mdfilesGenerate files with file reg support$cdmdfiles$mdtogh--file_reg='^\d.+\.md'Generate files with toc & toc_depth support$cdmdfiles$mdtogh--toc--toc_depth=2--file_reg='^\d.+\.md'Generate files with additional book info$cdmdfiles$mdtogh--toc--book='book.json'The format of book.json is given below.Generate files with custom template$cdmdfiles$mdtogh--templates=path_to_templates01.mdThe rules for templates is given below.Generate files with custom toc file$cdmdfiles$mdtogh--toc--toc_file=Readme.md--file_reg='^\d.+\.md'Offline rendering:$cdmdfiles$mdtogh--offline01.0.mdRecommandedoptions to generate book$mdtogh--css--toc--book='book.json'--file_reg='your reg exp'Recommandedoptions to generate several files$mdtogh01.md02.mdFor more optionsmdtogh-hSomething You May NoticeAs to generate files exactly like github does, the easiest way is to useapiif offers. But it has its ownlimits.60 for anonymous requests an hour5000 for requests using Basic Authentication an hourSo, you may using –user & –pass options$mdtogh--user='your_github_username'--pass='your login password'Your info are sended through https which is safe. mdtogh will not save any of it.book.json{"title":"Demo book","description":"This is a book.","coverimage":"demo.jpg"}Custom Templates Supportmdtogh now support custom templates. You can use –templates to specific where to locate templates. You should give at least three files belows:content.htmltoc.htmlindex.htmlmdtogh usejinja2as template engine.For tutorial of template writing, please checkjinja doccontent.htmlcontent.html is used for generate standalone html file with things like head, bodyaftercontent of md file is rendered by github or offline renderer.mdtogh will pass several  parameters to content.html which you can use:filetitle#booktitle in book.json`content#contents after render by `github` or `offline renderer`toc#not support yetneedtoc#whether toc is neededprevfile#link to prevfile. only used when `–toc` is setnextfile#link to nextfile. only used when `–toc`is settoc.htmltoc.html is used for generate table of content which will be used later in index.html. So, you don’t need add html or body tag.Parameters passed to toc.html.tocstoc_depthtocstocs is a list of headers. It’s set like[['h1','top header','headerlink'],['h2','sub header','header link'],....]toc_depthtoc_depth is set by user. It refers the maxium depth of header. It’s an integer value. ie.2index.htmlindex.html is used for generate index.html for book.Parameters passed to toc.html:booktitle#title in book.jsoncoverimage#coverimage in book.jsondescription#description in book.jsontoc#toc rendered with toc.htmlcustom_toc#whether use custom_toc. custom_toc is rendered like normal md fileTODOmdtogh is still on developing.Features are developing or will be add later.support recursive options.add toc in content.htmlContibutingAnyhelpwill beappreciated.open issues if you find any questionscomplete one in TODO listadd features you likefeel free to open pull requestLinksGithub repogripgithub markdown apiChange Log2014/4/30 0.0.9 add option: –timeout. set timeout for requests. add cache support. now it will skip file which is not changed.2014/3/12 0.0.8 add option: –offline. offline rendering is supported.2014/3/11 0.0.7 add option: –toc_file. user can specific one file as toc. relative link will be resolved automatically.2014/3/6 0.0.6 add option: –encoding for offline renderer, fix relative link, add support for custom template2014/3/5 0.0.5 add MANIFEST.in, fix pacakge wrapped by setup.py. Fix css link not include while rendering after first downloading css files2014/3/4 0.0.3 fix error leads by unicode filename2014/3/3 0.0.2 add –toc_depth support, fix get_html_name bug2014/3/1 0.0.1 first releaseThanksSpecial thanks togrip. Without its excellent work, this tool can’t be done.