Giter Site home page Giter Site logo

docpub's Introduction

DocPub

npm Build Status Coverage Status

DocPub is a command line utility for converting a folder structure of markdown files to HTML and uploading the result to Zendesk.

Getting Started

Installing

To install the utility, use npm install command:

npm install -g docpub

Global installation is used for launching commands.

Configuring

DocPub is configured using a config file. The only supported config file format is JSON. By default, DocPub looks for the config in the root of documentation folder by docpub.conf name. If needed, specific config location may be set with --config-path CLI option. Please note, that this option accepts path to the file, not to the folder, where config is located

The minimal config must include following required options:

  • username - name of ZenDesk user with documentation publish access rights
  • token - Zendesk API access token
  • url - fully qualified URL of your ZenDesk space

Example:

{
    "username": "[email protected]",
    "token": "abc123def456ghi789",
    "url": "https://example.zendesk.com"
}

Please see more about other configuration options and options overriding in config section.

Running

Run the command docpub from the directory that you wish to convert and upload.

This will do the following:

  • Convert the contained markdown files to HTML
  • Create a new category on Zendesk which contains sections matching the specified path's folder structure
  • Upload the HTML for each article into the corresponding section

Note: Alternatively, you can Run docpub -p {path} to run the utility on the specified path.

Folder Structure and Metadata

This utility will convert and upload files for a single Category on the Zendesk Help Center. Before running the utility, the markdown files that you wish to convert and upload must be within a certain folder structure that follows that Category > Section > Article structure of Zendesk. Each folder must also contain a meta.json file that has metadata about the Category, Section, or Article.

See Documentation Folder Structure for specifications on folder structure. See Metadata Format for specifications on the metadata file.

Development Guide

Getting Started

Run npm install to install dependencies. This will also setup the precommit and preversion hooks.

Running Tests

Run npm test to run the tests under the test directory with Mocha.

Tests are divided into unit tests and functional tests, and utilize SinonJS for spies, stubs, and mocks as well as ChaiJS for assertions.

Precommit and Preversion Hooks

husky is used to provide hooks prior to committing and versioning. This will run linter for commits and linter + all tests for releases. If any of the tests fail to pass or any file doesn't meet the ESLint specifications, you will not be allowed to commit or version.

docpub's People

Contributors

adher avatar corycaywood avatar greenkeeperio-bot avatar swinx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docpub's Issues

Add NPM badge

Just a fancy badge with link to latest version on NPM.

Add command line arguments to specify configuration

Currently DocPub is being configured with environment variables. Need to replace it with convenient command line arguments.
Command line arguments should override environment variables and configuration file.

Minimum required arguments (if one is specified, the two others must be specified):
username: string, name of ZenDesk user from whose name docs would be published
apiToken: string, ZenDesk API token of the user
url: string, zendesk root URL

In rendered HTML code code is not being highlighted

Highlight.js markup is being applied, but css is missing from generated HTML.
Issued can be fixed in several ways:

  • Inline styles to the generated code
  • Add a link tag pointing to the css deployed on public CDN
  • Do not include css to generated html. Instead write a guide how user can include it to ZenDesk template.

Setup coveralls

Setup sending coverage reports to coveralls for each PR/merge.
Setup coveralls to accept this reports and update badge for each PR/merge
Add badge to the readme

Add configuration file

Currently DocPub is being configured with environment variables. Need to replace it with convenient config.
Config name should be .docpub.config
Config should be located in a folder submitted to publish
Minimum required fields:

  • username: string, name of ZenDesk user from whose name docs would be published
  • apiToken: string, ZenDesk API token of the user
  • url: string, zendesk root URL

Setup Travis.ci

Need to setup travis CI to execute tests for each PR and merge.
Node versions to run tests at: current LTS + all greater major versions
Add tests badge to readme

Socket Hang Up error

Need to investigate what causes this error:

Upload failed!
socket hang up
Error: socket hang up
   at createHangUpError (_http_client.js:302:15)
   at TLSSocket.socketOnEnd (_http_client.js:394:23)
   at emitNone (events.js:91:20)
   at TLSSocket.emit (events.js:186:7)
   at endReadableNT (_stream_readable.js:974:12)
   at _combinedTickCallback (internal/process/next_tick.js:74:11)
   at process._tickCallback (internal/process/next_tick.js:98:9)

Enable pointing to another article by pointing to it's .md file

Now link to other article will only work if it will point to article folder, not .md file. Reason for this is because article is being considered as composite entity, including metadata, markdown and resources.
Need to make explicit check in article is the current path chunk is last one and is it equal markdown file name.

Add CLI option to clear unused article attachments

A method is needed for deleting unused article attachments from Zendesk. Zendesk doesn't have an API for updating attachments, so anytime an attachment is updated in the local repository, a completely new attachment is uploaded to Zendesk.

Currently, the old attachment is never deleted, it just continues to exist on Zendesk even though it isn't used. Due to the way the synchronization feature was implemented, it isn't possible to delete the old attachment at the same time as uploading a new one.

So a feature needs to be added for finding and deleting unused attachments on Zendesk.

This should not run as part of the "synchronization" step because it will require many API calls. The only way to get a list of attachments is to call the list for each article. This is why I suggest it should be a command line option, such as --clearattachments.

Publish docpub documentation GH pages using gitbook

This issue is about publishing docpub's own documentation to GH pages, not about publishing 3rd-party documentation to the gitbook service.

Example of gitbook output: http://redux.js.org

Gitbook CLI: https://www.npmjs.com/package/gitbook-cli
GH pages: https://pages.github.com

Proposed flow:
On each build CI triggers gitbook build so we may make sure that documentation is not corrupted
On each release we person, responsible for release will also need to publish gitbook manually. (probably this could be automated too?)

Add typed errors

Now in all cases generic errors are being reported, need to make them more specific and make error messages more verbose
For each class of errors need to add specific type inheriting from Error.
Message should return detailed information about the case.

Disable local test run before commit

Because previously Travis was not integrated, tests were triggered locally for each commit by husky.
Now merge is not allowed without CI success, so double test run is redundant.
Test run before release should remain.

Add to the meta.json file "comments_dissabled" YES/NO setting

Who

Beneficiary : Content/documentation creators.

What

In the docpub meta.json add the optional setting of {"comments_disabled" : "yes"} .

Name Type Read-only Mandatory Comment
comments_disabled boolean no no True if comments are disabled; false otherwise

Why

Depending to the administrator of the documentation, this setting will be useful to lock the content and don't have to manually respond or enter in a discussion in the article page.
We could get feedback through one channel ( email ).

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.