GithubHelp home page GithubHelp logo

matkm / docx2gfm Goto Github PK

View Code? Open in Web Editor NEW

This project forked from spier/docx2gfm

0.0 1.0 0.0 550 KB

Converts a docx file to github-flavored-markdown

License: MIT License

Ruby 98.40% Shell 1.60%

docx2gfm's Introduction

docx2gfm - docx to github-flavored-markdown converter

If you need to convert .docx documents to markdown, then docx2gfm helps you to make the process faster.

"Don't tell me, show me"! Ok ok! docx2gfm turns this docx file into this markdown. Also see the original google Doc.

For another example of docx2gfm in action, take a look at this blog post docx2gfm - Your friendly docx to markdown converter.

While some post-processing of the markdown is still required, docx2gfm already makes the conversion process much faster.

The Long Story

I am maintaining an engineering blog, that uses jekyll to generate static pages.

In our blogging process, the authors write blog post as a Google Doc to collect feedback. Once the post is ready for publishing, they convert the Google Doc to github-flavored-markdown, as that is what jekyll needs as input to render the HTML for the blog.

We used to do this conversion step manually. This was tedious, boring, and in parts error-prone.

With docx2gfm you can do this conversion quickly, and have more time to write new blog posts ... or drink coffee :)

Technically docx2gfm is a thin wrapper around pandoc. In MOTIVATION.md you find more about the technical approach we chose.

Installation

  • install ruby
  • install pandoc
  • install this gem: gem install docx2gfm

Usage

  1. download your Google Doc as a .docx file e.g. my_post.docx (File >> Download as >> Microsoft Word (.docx))
  2. convert docx to github-flavored-markdown:
docx2gfm -f my_post.docx > my_post.md

To learn more about the available options please refer to the built-in help.

$ docx2gfm -h

Usage: docx2gfm [options]
    -f, --file FILE                  (required) The .docx file to convert to markdown
    -j, --[no-]jekyll                (optional) Prefix the markdown output with a jekyll frontmatter. Default: --jekyll
    -r, --[no-]ref-style-links       (optional) Create reference style links at the end of the markdown. Default: --ref-style-links
    -h, --help                       Display this help screen

Finishing touches for your markdown

The markdown produced by docx2gfm is good but not perfect. You still have to do some manual steps:

  • Adapt the YAML Frontmatter (if you used the --jekyll option)
  • Add the correct image paths
  • Double check code blocks
  • Double check quotes
  • Double check tables

Alternatives to docx2gfm

Development

After checking out the repo, run bin/setup to install dependencies. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

docx2gfm is far from perfect. Bug reports and pull requests are welcome on GitHub at github.com/spier/docx2gfm.

License

The gem is available as open source under the terms of the MIT License.

docx2gfm's People

Contributors

spier avatar

Watchers

James Cloos avatar

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.