Giter Site home page Giter Site logo

jamiemason / self-help Goto Github PK

View Code? Open in Web Editor NEW
35.0 3.0 3.0 7.44 MB

Interactive Q&A Guides for Web and the Command Line.

Home Page: https://jamiemason.github.io/self-help/

License: MIT License

JavaScript 4.25% TypeScript 95.75%
onboarding interactive-tutorial command-line documentation documentation-generator q-and-a helpdesk wiki walkthrough walkthrough-help

self-help's Introduction

self-help

Interactive Q&A Guides for Web and the Command Line

NPM version NPM downloads Build Status Maintainability

Table of Contents

๐ŸŒฉ Installation

npm install --global self-help

๐Ÿ•น Usage

Interactive CLI

Navigate a Self-Help Document from the Command Line:

self-help interactive --source ./path/to/help-document.js

Example

screenshot

Generate Markdown

Generate Markdown from a Self-Help Document:

self-help markdown --source ./path/to/help-document.js

Markdown is written to stdout for you to pipe into other Command Line Programs or write to a file.

Example

The self-help RxJS Operator Decision Tree Example exported as Markdown.

๐Ÿ‘ฉ๐Ÿฝโ€๐Ÿ’ป Writing Documents

A Help Document is a JavaScript Module exporting a getHelpDocument method of type GetHelpDocument.

type GetHelpDocument = () => Node | Promise<Node>;

It returns a Nested Hierarchy of Node Objects.

type Node = Leaf | Branch | AsyncBranch;

Which form the Decision Tree a User will navigate.

export const getHelpDocument = (): Node => ({
  label: "Welcome to Milk and Cookies, how can we help?",
  children: [
    {
      label: `I'm Thirsty, and`,
      children: () => http.get("/milks-walkthrough.json")
    },
    {
      label: `I'm Hungry, and`,
      children: [
        {
          label: "I love Cookies, so",
          children: () => http.get("/cookies-walkthrough.json")
        },
        {
          label: `Cookies aren't my thing`,
          value: fs.readFileSync("/GET-OUT.md", "utf8")
        }
      ]
    }
  ]
});

Node Types

Branch

A Branch presents multiple options to choose from in the form of its children Array. Children can be a combination of other Branch, AsyncBranch or Leaf Nodes.

{
  label: 'I just cloned the project, and',
  children: [...]
}

AsyncBranch

An AsyncBranch is the same as a Branch except its children property is a Function which returns a Promise.

This mechanism allows Help Documents to be combined and linked together, use it to compose higher-level guides which pull together other Help Documents hosted online or break down a large Help Document into smaller files that can be lazily-loaded at runtime.

{
  label: 'I just cloned the project, and',
  children: () => Promise.resolve([])
}

Leaf

A Leaf represents the answer the User has been looking for as they have been navigating a given Help Document. The value can be any String, but is normally the contents of a Markdown Document which explains the answer to the User.

{
  label: 'I want to install dependencies',
  value: fs.readFileSync('/installation.md', 'utf8')
}

๐Ÿ™‹๐Ÿฟโ€โ™‚๏ธ Getting Help

Get help with issues by creating a Bug Report or discuss ideas by opening a Feature Request.

๐Ÿ‘€ Other Projects

If you find my Open Source projects useful, please share them โค๏ธ

๐Ÿค“ Author

I'm Jamie Mason from Leeds in England, I began Web Design and Development in 1999 and have been Contracting and offering Consultancy as Fold Left Ltd since 2012. Who I've worked with includes Sky Sports, Sky Bet, Sky Poker, The Premier League, William Hill, Shell, Betfair, and Football Clubs including Leeds United, Spurs, West Ham, Arsenal, and more.

Follow JamieMason on GitHubย ย ย ย ย ย Follow fold_left on Twitter

self-help's People

Contributors

jamiemason avatar

Stargazers

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

Watchers

 avatar  avatar  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.