GithubHelp home page GithubHelp logo

joshooaj / platyps Goto Github PK

View Code? Open in Web Editor NEW

This project forked from powershell/platyps

0.0 0.0 0.0 5.17 MB

Write PowerShell External Help in Markdown

Home Page: https://powershellgallery.com/packages/joshooaj.platyPS

License: MIT License

JavaScript 5.64% C# 54.95% PowerShell 34.11% CSS 3.65% HTML 1.64%

platyps's Introduction

joshooaj.PlatyPS

Introduction

This repo is a fork of the official PlatyPS repo where I have updated the module to suit my needs. Once PlatyPS v1 is released with support for PowerShell 7.4 and a whole bunch of other improvements, I will be abandoning this repo in favor of the new and improved PlatyPS.

Differences

  • Bumped target framework to netstandard2.0 and dropped net451 as a target. This may impact compatibility with other libraries your project(s) use, and limits .NET Framework compatibility to a minimum version of 4.6.1. See the .NET Standard version matrix.
  • Added ProgressAction to the list of common parameters which eliminates the common parameter from being listed independently as a parameter in the markdown files produced by New-MarkdownHelp.
  • Renamed module to joshooaj.platyPS and updated the module GUID to ensure there is no confusion that this is an independently published version of PlatyPS.
  • Removed Windows-only tests from the Pester tests and updated tests as needed.
  • Uses GitHub Actions to automate tests and publishing.
  • Uses Nerdbank.GitVersioning to set the version number

(Mostly) Original README

PlatyPS provides a way to:

  • Write PowerShell External Help in Markdown
  • Generate markdown help (example) for your existing modules
  • Keep markdown help up-to-date with your code

Markdown help docs can be generated from old external help files (also known as MAML-xml help), the command objects (reflection), or both.

PlatyPS can also generate cab files for Update-Help.

Why?

Traditionally PowerShell external help files have been authored by hand or using complex tool chains and rendered as MAML XML for use as console help. MAML is cumbersome to edit by hand, and common tools and editors don't support it for complex scenarios like they do with Markdown. PlatyPS is provided as a solution for allow documenting PowerShell help in any editor or tool that supports Markdown.

An additional challenge PlatyPS tackles, is to handle PowerShell documentation for complex scenarios (e.g. very large, closed source, and/or C#/binary modules) where it may be desirable to have documentation abstracted away from the codebase. PlatyPS does not need source access to generate documentation.

Markdown is designed to be human-readable, without rendering. This makes writing and editing easy and efficient. Many editors support it (Visual Studio Code, Sublime Text, etc), and many tools and collaboration platforms (GitHub, Visual Studio Online) render the Markdown nicely.

Common setups

There are 2 common setups that are used:

  1. Use markdown as the source of truth and remove other types of help.
  2. Keep comment based help as the source of truth and periodically generate markdown for web-site publishing.

They both have advantages and use-cases, you should decide what's right for you. There is slight preference toward number 1 (markdown as the source).

Quick start

Install-Module -Name joshooaj.platyPS -Scope CurrentUser
Import-Module joshooaj.platyPS
  • Create initial Markdown help for MyAwesomeModule module:
# you should have module imported in the session
Import-Module MyAwesomeModule
New-MarkdownHelp -Module MyAwesomeModule -OutputFolder .\docs
  • Edit markdown files in .\docs folder and populate {{ ... }} placeholders with missed help content.

  • Create external help from markdown help

New-ExternalHelp .\docs -OutputPath en-US\
  • Congratulations, your help is now in markdown!

  • Now, if your module code changes, you can easily update your markdown help with

# re-import your module with latest changes
Import-Module MyAwesomeModule -Force
Update-MarkdownHelp .\docs

PlatyPS markdown schema

Unfortunately, you cannot just write any Markdown, as platyPS expects Markdown to be authored in a particular way. We have defined a schema to determine how parameters are described, where scripts examples are shown, and so on.

The schema closely resembles the existing output format of the Get-Help cmdlet in PowerShell.

If you break the schema in your markdown, you will get error messages from New-ExternalHelp and Update-MarkdownHelp. You would not be able to generate extrenal help or update your markdown.

It may be fine for some scenarios, i.e. you want to have online-only version of markdown.

Supported scenarios:

  • Create Markdown

    • Using existing external help files (MAML schema, XML).
    • Using reflection
    • Using reflection and existing internal external help files.
    • For a single cmdlet
    • For an entire module
  • Update existing Markdown through reflection.

  • Create a module page .md with summary. It will also allow you to create updatable help cab.

  • Retrieve markdown metadata from markdown file.

  • Create external help xml files (MAML) from platyPS Markdown.

  • Create external help file cab

  • Preview help from generated maml file.

Remoting

PlatyPS supports working with Import-PSSession aka implicit remoting. Just pass -Session $Session parameter to the platyPS cmdlets and it will do the rest.

Build

For information about building from sources and contributing see contributing guidelines.

platyps's People

Contributors

vors avatar logosnazerath avatar jongeller avatar adityapatwardhan avatar yingdabeyondsoft avatar sdwheeler avatar daviwil avatar joshooaj avatar dotps1 avatar berniewhite avatar it-praktyk avatar francisco-gamino avatar jazzdelightsme avatar joeyaiello avatar yishengjin1413 avatar przemyslawklys avatar thomasnieto avatar jameswtruher avatar darquewarrior avatar stevel-msft avatar xmdanni avatar thisisnotarobot avatar tlindsay42 avatar pcgeek86 avatar timshererwithaquent avatar gitter-badger avatar swernli avatar sergeytunnik avatar natescherer avatar miamiax 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.