iainbrighton / PScribo

PowerShell documentation framework
MIT License
230 stars 35 forks source link

Markdown Output Formatting #109

Open iainbrighton opened 4 years ago

iainbrighton commented 4 years ago

Markdown is meant to be a human-readable document format and some PScribo options aren't well suited to its output (unless converted to Html by a parser/renderer). Whilst working on the Markdown plugin, several rendering questions have arisen and I'd like the community's feedback.

Any feedback is greatly appreciated! Thanks, Iain

iainbrighton commented 4 years ago

Initial implementation with the Markdown plugin can be found here: https://github.com/iainbrighton/PScribo/tree/Issue36. Here is the contents of the about_MarkdownPlugin help file.

TOPIC
    Markdown

SYNOPSIS
    PScribo supports outputting GitHub Flavored Markdown format (.md) documents.

DESCRIPTION
    Markdown is a plain text format for writing structured documents, based on conventions for indicating formatting
    in email and usenet posts. PScribo implements the GitHub Flavored Markdown (GFM) specification which is a
    strict superset of the CommonMark specification (https://github.github.com/gfm/).

KNOWN LIMITATIONS
    There are some restrictions emposed by the GFM specification that means that some PScribo functionality cannot
    either be partially or fully implemented:

    - No indentation (-Tab) support as indented text is rendered as code blocks.
    - Text underlining is not supported/defined in the specification.
    - Image resizing is not supported/defined in the specification.
    - Only image links are included in the Markdown output, by default (see Plugin Options below).
      - Local image file references may not be rendered by some Markdown parsers/viewers (for security).
    - Numbered lists only support one level of indentation.
    - Headers and footers are not rendered in the output.

PLUGIN OPTIONS
    The Markdown plugin accepts the following output customisation options:

        TextWidth [int]               : Sets the default line length used for rendering output. If not specified,
                                        defaults to 120 characters per line. Note: table output is not wrapped.
        PageBreakSeparator [char]     : Specifies the character used for page breaks. If not specified, defaults
                                        to '*'.
        PageBreakSeparatorWidth [int] : Specifies the width of the rendered page break. If not specified, defaults
                                        to 20.
        LineBreakSeparator [char]     : Specifies the character used for line breaks. If not specified, defaults
                                        to '-'.
        LineBreakSeparatorWidth [int] : Specifies the width of the rendered page break. If not specified, defaults
                                        to 10.
        EmbedImage [bool]             : By default, web/file image links are included in the Markdown file. If enabled,
                                        all images will be Base64-encoded and appended to the end of the file.
        RenderBlankLine [bool]        : Markdown parsers typically ignore multiple/consecutive blanklines. When enabled,
                                        this option will output Html line breaks to ensure they are rendered by Markdown
                                        viewers.

    Output customisations are passed to the Export-Document cmdlet, e.g.

    PS> $document | Export-Document -Format Markdown -Options @{ EmbedImage = $true }
DSI-BenThomas commented 1 year ago

Was there a plan to finish this at some point? Or were you looking for assistance to test it?

carceneaux commented 1 year ago
  • Should headers and footers be included in Markdown (.md) documents?

The way I handled this in the JSON plugin is I included the header only once at the beginning and the footer only once at the end. My thought was the header/footer could potentially contain valuable information but it doesn't need to be seen more than once given there's no actual "pages".

  • Should image data be included at the bottom of the Markdown (.md) document?

I'd say keep it simple for MVP. The tried and true traditional image links referencing the external file(s) will be fine for most folks.

Additionally, I've performed an initial review of the Markdown plugin code. Overall, it's looking pretty good! Outside of the items referenced above, here's some bugs/oddities I found: