V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
爱意满满的作品展示区。
marchtea
V2EX  ›  分享创造

最近写的将 markdown 文件转化成 html,并且支持目录生成的工具---mdtogh

  •  
  •   marchtea ·
    marchtea · 2014-03-03 18:43:14 +08:00 · 4044 次点击
    这是一个创建于 3699 天前的主题,其中的信息可能已经有所发展或是发生改变。
    最近在github上参与了The Art Of Programming By July的项目, 参与了生成电子书脚本的编写. 由于发现pandoc生成的html文件不太理想,因此就开始自己写了一个转化工具--mdtogh.

    Github repo: https://github.com/marchtea/mdtogh

    转换生成的效果: http://taop.marchtea.com
    内容是The Art Of Programming By July中的文档.

    相较于pandoc,优势在于:

    1. 每个md文件对应一个html
    2. 每个html文件中具有上一章,下一章, 首页链接.
    3. 采用github api, 显示效果和github是一致的.
    4. 有一个主页index.html,里面显示了书的基本信息以及目录
    5. 安装简单.工具托管在pypi中,直接使用pip install mdtogh就可以安装了.

    欢迎大家使用.有任何问题欢迎open issue, 能有pull request就更好不过了 :)
    9 条回复    1970-01-01 08:00:00 +08:00
    bitbegin
        1
    bitbegin  
       2014-03-03 19:17:05 +08:00   ❤️ 1
    貌似不错,就是没时间玩
    jakwings
        2
    jakwings  
       2014-03-03 21:08:35 +08:00   ❤️ 1
    不错,遇见有趣的书。
    marchtea
        3
    marchtea  
    OP
       2014-03-03 21:20:41 +08:00
    @bitbegin @jakwings 感谢送上.
    slixurd
        4
    slixurd  
       2014-03-03 21:57:03 +08:00   ❤️ 1
    报个问题= =
    不是生成器的,是内容的
    你的第三章和第三章续是同个html同个anchor
    marchtea
        5
    marchtea  
    OP
       2014-03-03 22:04:51 +08:00
    @slixurd 这个应该是我生成器的bug.我去看看.
    marchtea
        6
    marchtea  
    OP
       2014-03-03 22:16:16 +08:00
    @slixurd bug修复了.已更新到github. pypi最近抽风.服务好了就上传上去. 感谢送上.
    pharaohnie
        7
    pharaohnie  
       2014-03-04 10:07:35 +08:00
    加toc参数的时候报错了。

    <code>
    mdtogh --toc
    Github css files are not cached. Download First
    Fetching css url from https://github.com/marchtea/md_to_github_html ......done
    Download css file: github-adb8493796a61d936498dd1a4b4e778c3423de88.css ... done
    Download css file: github2-9d4a20ad5262fb38bc67f83e9dcc9faf7d35d7f5.css ... done
    2 files in render list...
    1 / 2 : Rendering: ./服务.md Error: 'ascii' codec can't decode byte 0xe6 in position 0: ordinal not in range(128)
    </code>
    marchtea
        8
    marchtea  
    OP
       2014-03-04 10:30:08 +08:00
    @pharaohnie 可能是文件名是中文导致的.我试试.
    marchtea
        9
    marchtea  
    OP
       2014-03-04 11:07:18 +08:00
    @pharaohnie 确实是中文名引起的.bug已修复,推到github上了.
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2729 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 00:21 · PVG 08:21 · LAX 17:21 · JFK 20:21
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.