Skip to content

Convert docx files to simple HTML for WordPress.

License

Notifications You must be signed in to change notification settings

nursingclio/doc-converter

Repository files navigation

Nursing Clio Doc Converter

Download GPLv3 License

A Node tool designed to convert Word (docx) files into simple HTML suitable for WordPress.

Description

This tool will convert all .docx files in the input folder into WordPress-style HTML. WordPress-style HTML, in this case, means it doesn't bother with <p> tags or other entities that will be taken care of by the WordPress autop filter.

The following features are currently supported:

  • Paragraphs
  • Headings
  • Lists
  • Footnotes (will be converted to endnotes wrapped in the appropriate Notes section)
  • Blockquotes

Prerequisites

The Nursing Clio Doc Converter requires NodeJS and npm. Node 15 is the recommended version of node to use. NC Doc Converter will probably work with other versions of node (at least as far back at 10), but no promises.

You can confirm node and npm are installed by running the following commands in a terminal:

node -v
npm -v

MacOS

NodeJS and npm can be installed from the NodeJS website, using a package manager like Homebrew, or using a version manager like nvm.

Windows

NodeJS and npm can be installed from the NodeJS website, or by using the WSL and following the instructions for Linux.

Linux

NodeJS and npm can be installed using a package manager (follow the instructions on the nvm), or using a version manager like nvm.

Installation

Once the installation prerequisites are met, you are ready to install and use the NC Doc Converter.

Install from source

  • Download the latest version from GitHub and extract it into whatever directory you like.
  • Open a terminal in the Doc Converter directory. (The shortcut for this is to double-click on the File Explorer address bar or press alt + d, and then type cmd and press enter.)
  • Install the npm dependencies with the command: npm install

Install using Git

If you prefer to use Git to keep the NC Doc Converter up to date, you can instead clone it into your desired directory with git clone https://github.com/nursingclio/doc-converter.git.

  • Open a terminal in the Doc Converter directory. (The shortcut for this is to double-click on the File Explorer address bar or press alt + d, and then type cmd and press enter.)
  • Install the npm dependencies with the command: npm install

How to Use

MacOS and Linux

  1. Move the docx files you want to convert into the input folder in the NC Doc Converter folder (which will be called "doc-converter-x.x.x" or "doc-converter" by default).
  2. The NC Doc Converter must be run from a terminal. Open a terminal in the Doc Converter directory.
  3. Run the command npm run NCconvert
  4. You should now find html files in the output directory corresponding to the docx files in the input directory.
  5. You can run the NCconvert npm command multiple times with the same files. The output file will be overwritten.
  6. To clean up you can either manually remove the input and output files, or you can run the command npm run clean to delete all of the files in both input and output directories.

Windows

  1. Move the docx files you want to convert into the input folder in the NC Doc Converter folder (which will be called "doc-converter-x.x.x" or "doc-converter" by default).
  2. The NC Doc Converter must be run from a terminal. Open a terminal in the Doc Converter directory. The shortcut for this is to double-click on the File Explorer address bar or press alt + d, and then type cmd and press enter.
  3. Run the command npm run NCconvertwin
  4. You should now find html files in the output directory corresponding to the docx files in the input directory.
  5. You can run the NCconvertwin npm command multiple times with the same files. The output file will be overwritten.
  6. To clean up you can manually remove the input and output files. (The clean script does not work in Windows at this time.)

Updating

  • If you installed manually using the source code file, you can update at any time by downloading a new version and replacing the old files with the new ones.
  • If you installed using Git you can run git pull origin stable to update to the latest stable version.

CLI Commands

Default usage: npm run NCconvert

Other commands:

  • npm run clean: Delete all files in the input and output folders.
  • npm run clean:input: Delete all files in the input folder only.
  • npm run clean:output: Delete all files in the output folder only.