GithubHelp home page GithubHelp logo

markdownrender's Introduction

Microsoft.PowerShell.MarkdownRender

This repository s for the NuGet package Microsoft.PowerShell.MarkdownRender. The component is used by Show-Markdown and ConvertFrom-Markdown PowerShell cmdlets.

This component is planned to be used by PlatyPS as well.

markdownrender's People

Contributors

adityapatwardhan avatar daxian-dbw avatar xtqqczze 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

Watchers

 avatar  avatar  avatar  avatar

markdownrender's Issues

Either output a `NewLine` *before* output (in addition to after) or *don't* output one.

  1. Summary of the new feature / enhancement

    Like PowerShell/PowerShell#14444 (comment) explains, Show-Markdown appears to output an unnecessary [Environment]::NewLine after invocation, which makes it difficult to read (because it doesn't even use one before the output too). https://github.com/MicrosoftDocs/PowerShell-Docs/blob/6ff8e52c11aabb6ea5724a6bd2952adfb6f2df12/reference/7.5/Microsoft.PowerShell.Utility/Show-Markdown.md#syntax doesn't list a way to disable this.

  2. Proposed technical implementation details (optional)

    Don't emit a [Environment]::NewLine prepended to the output, or at the least, prepend one.

  3. Additional Information

    1. Reported here due to https://github.com/PowerShell/MarkdownRender/blob/d26903f1ba6efda8912662794977b4b718b5f68e/README.md?plain=1#L4:~:text=the%20component%20is%20used%20by%20%60show-markdown%60.

    2. I've tested this on:

      sudo snap install $(what-snap 'JSNnoJl3EqkMuWoy5Dgq8PMqZ0uNcpie' | awk '{print $2}') --classic --channel=latest/stable --revision 264 # https://forum.snapcraft.io/t/can-i-install-a-package-using-its-snap-id/39053/4?u=beedellrokejulianloc

Update the version of MarkDig

Summary of the new feature / enhancement

The version of MarkDig used in the module is 0.22.0. The latest version of MarkDig is 0.30.2.

Because this module is loaded in PowerShell automatically, a non-binary module has no way of using a newer version of MarkDig. There are two particular features added in later releases that would be extremely useful for module authors: the Descendants() method and the ability to round-trip markdown.

Version 0.22.0 was released in October 2020. I suspect that the longer we go between updating the version here, the more work is involved in doing a future update.

Proposed technical implementation details (optional)

Update the version of MarkDig.Signed to the latest version and adjust tests/implementation as required to keep existing functionality.

Microsoft.PowerShell.MarkdownRender.MarkdownInfo.ToString() should be the HTML

Summary of the new feature / enhancement

As a user, I want to be able to more seamlessly work with Markdown in PowerShell.

Unfortunately, when I try to ToString() a Markdown object, I get:

Microsoft.PowerShell.MarkdownRender.MarkdownInfo

This makes easily embedding markdown inside of a string more painful than it needs to be, and also complicates logic for -joining multiple markdowns

Proposed technical implementation details (optional)

The .ToString() method the MarkdownInfo class should be the converted HTML.

list item doesn't start on new line if inline code at end of previous list item

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest version
  • Search the existing issues.

Steps to reproduce

This does not render correctly:

1. `inline code`
2. item 2
3. item 3

* `inline code`
* item 2
* item 3

It renders like this:
image

Expected behavior

1. inline code
2. item 2
3. item 3

* inline code
* item 2
* item 3

Actual behavior

1. inline code2. item 2
3. item 3

* inline code* item 2
* item 3

Error details

No response

Environment data

Name                           Value
----                           -----
PSVersion                      7.3.0
PSEdition                      Core
GitCommitId                    7.3.0
OS                             Microsoft Windows 10.0.19044
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Version

pwsh 7.3.0

Visuals

Expected behavior:
image

Load Markdig in an assembly load context

Summary of the new feature / enhancement

As a developer working on a PowerShell module that interacts with Markdown, I want to be able to use newer versions of the Markdig library without conflict errors. Because Markdig isn't loaded in an ALC, using a newer version of Markdig in my module isn't feasible.

One reason to desire a newer version of the library is to gain access to the round-tripping support and more walkable AST.

Proposed technical implementation details (optional)

Update the module to load Markdig in an ALC. No change is required to the version of Markdig used.

Dependency on host OS does not support remoting

Summary of the new feature / enhancement

In VT100EscapeSequences.cs is the following code

        // MacOS terminal app does not support extended colors for VT100, so we special case for it.
        Code = RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? CodeMacOS : isDarkTheme ? CodeDark : CodeLight;

This would not work if the user is using MacOS to ssh to another platform and running PowerShell there (eg a linux host in the cloud), or using another platform and using SSH to talk to a MacOS machine (eg a build server).

Proposed technical implementation details (optional)

No response

Add YAML Frontmatter extraction support

Related to PowerShell/PowerShell#16857.

This is already a native feature of Markdig, so it should be as easy as calling .UseYamlFrontMatter() on MarkdownPipelineBuilder before .Build().

Given that these are essentially document properties, a property added to [Microsoft.PowerShell.MarkdownRender.MarkdownInfo] instances that extracts YAML frontmatter (if present) and deserializes to a CLR object would likely be the most sensible to use.

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.