GithubHelp home page GithubHelp logo

html2markdown4blog's Introduction

Html2Markdown4Blog

##Blog迁移 这是一个将传统博客系统迁移到用Markdown格式书写的静态博客系统(例如Jekyll)的工具。 它能识别并截取HTML页面的文章内容,再转换成Markdown格式的文件。 注意目前仅支持CSDN Blog

由于目前并没有针对转换后的排版做很多优化(而且CSDN编辑器生成的格式又挺乱的..),所以要获得很好的浏览体验的话,可能还需要你手动做一些微调。

##批量转换 支持批量转换,输入目录页面的地址就可以转换所有的文章,能自动识别分页。 转换完成后会保存到本地目录。

##Front-matter 支持添加Jekyll(Octopress),Hexo或自定义的YAML front-matter

Requirements

  • PHP Version >= 5
  • cURL PHP Extension (请注意运行环境,CLI和Apache下的php.ini可能是不同的)
  • 如果文章过多可能造成执行时间较长,需注意max_execution_time的配置

Usage

//git clone 或 下载: https://github.com/baizhebz/html2markdown4blog/archive/master.zip
git clone https://github.com/baizhebz/html2markdown4blog.git

cd html2markdown4blog

//编辑setting.php文件中的配置,修改archive_url或post_url,填入要转换的目录页地址或一篇单独的文章的地址

//在CLI模式下运行,或者部署到你的web server,使用curl或直接在浏览器里访问 your_host/start.php
php start.php

html2markdown4blog's People

Contributors

baizhebz avatar

Stargazers

 avatar lukeLee avatar w金龙 avatar Wenliang ZHANG avatar xpp avatar  avatar Danielding avatar Xitao Zhang avatar wot avatar MayGodBlessYou avatar Kevin avatar ZhangChun avatar NULL avatar  avatar  avatar Garvin avatar Joey  avatar Ying avatar

Watchers

 avatar Jackroyal avatar pinghailinfeng avatar helenz avatar  avatar abel avatar  avatar

html2markdown4blog's Issues

用xampp运行这个工具报错

Fatal error: Uncaught Error: Call to a member function hasChildNodes() on null in /opt/lampp/htdocs/csdn/lib/PostPageParser.php:292 Stack trace: #0 /opt/lampp/htdocs/csdn/lib/PostPageParser.php(109): PostPageParser->_parse_element(NULL) #1 /opt/lampp/htdocs/csdn/start.php(60): PostPageParser->parse() #2 {main} thrown in /opt/lampp/htdocs/csdn/lib/PostPageParser.php on line 292

markdown文件名问题

1.lib/PostPageParser.php:123 这样处理文件名再MACOSX下面会出现乱码
2.jekyll用户生成的markdown文件名需要带上时间戳,类似2014-01-23-hello-world.md

Call to a member function hasChildNodes() on null

Fatal error: Uncaught Error: Call to a member function hasChildNodes() on null in /root/html2markdown4blog/lib/PostPageParser.php:292 Stack trace: #0 /root/html2markdown4blog/lib/PostPageParser.php(109): PostPageParser->_parse_element(NULL) #1 /root/html2markdown4blog/start.php(60): PostPageParser->parse() #2 {main} thrown in /root/html2markdown4blog/lib/PostPageParser.php on line 292
不懂php的路过

应该增加一个posts目录

在执行php start.php时,第一次看到报错,都是提示no such file or directory。然后发现是要导出到posts目录,加了目录后才导出成功。非常好用!

jekyll的markdown模板问题


---
layout: some-specify-layout
title: article title
description: "description content"
date: xxxx-xx-xx
category: category
tags: [tag1, tag2, tag3]

---

这样可能更适合jekyll用户一些

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.