Giter VIP home page Giter VIP logo

docusaurus.powershell's People

Contributors

alt3-ci avatar bravo-kernel avatar btimmerm avatar dependabot[bot] avatar jmkloz 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

Watchers

 avatar  avatar  avatar  avatar

docusaurus.powershell's Issues

Period followed by space causes line break in generated comment based help

Following the discussion on this pr and noticing that this is still persisting https://pester.dev/docs/commands/New-PesterConfiguration#description it seems like there is still a regex that is a little too eager to help.

Unless the Pester 5.4.0 docs are not using the latest Alt3.Docusaurus.Powershell (which I cannot seem to tell what version it is using) then there may still be something amiss with that part of the generation.

Fix multiline examples

PlatyPS is not handling multi-line examples correctly like can be seen on this screenshot taken from https://deploy-preview-1--pester-docs.netlify.com/docs/commands/Add-AssertionOperator

image

Code

The PlatyPS generated markdown with incorrectly closed code fence block responsible for above image
### EXAMPLE 1
\`\`\`powershell
function BeAwesome($ActualValue, [switch] $Negate) {
\`\`\`

\[bool\] $succeeded = $ActualValue -eq 'Awesome'
	if ($Negate) { $succeeded = -not $succeeded }

	if (-not $succeeded)
	{
		if ($Negate)
		{
			$failureMessage = "{$ActualValue} is Awesome"
		}
		else
		{
			$failureMessage = "{$ActualValue} is not Awesome"
		}
	}

	return New-Object psobject -Property @{
		Succeeded      = $succeeded
		FailureMessage = $failureMessage
	}
}

Add-AssertionOperator -Name  BeAwesome `
					-Test  $function:BeAwesome `
					-Alias 'BA'

PS C:\\\> "bad" | should -BeAwesome

{bad} is not Awesome
How the code fence block should look
### EXAMPLE 1
\`\`\`powershell
function BeAwesome($ActualValue, [switch] $Negate) {

\[bool\] $succeeded = $ActualValue -eq 'Awesome'
	if ($Negate) { $succeeded = -not $succeeded }

	if (-not $succeeded)
	{
		if ($Negate)
		{
			$failureMessage = "{$ActualValue} is Awesome"
		}
		else
		{
			$failureMessage = "{$ActualValue} is not Awesome"
		}
	}

	return New-Object psobject -Property @{
		Succeeded      = $succeeded
		FailureMessage = $failureMessage
	}
}

Add-AssertionOperator -Name  BeAwesome `
					-Test  $function:BeAwesome `
					-Alias 'BA'

PS C:\\\> "bad" | should -BeAwesome

{bad} is not Awesome
\`\`\`

Possible solution

Docusaurus.Powershell already used the UpdateMarkdownCodeBlock function function for adding the powershell moniker to code fences.

Perhaps something similar/smart can be done for the multi-line examples.

Additional Information (and possible solution)

More information on this PlatyPS issue here PowerShell/platyPS#180.

Exception when Append/PrependMarkdown includes certain wildcard characters

image

Exception is thrown by Test-Path here
Can repro with same string using Test-Path in unix only (pester/docs devcontainer).

$t = @"
:::note This page was generated using the comment based help in Pester $($ModuleList.Pester).
To edit the content of this page, change the corresponding help in the [pester/pester](https://github.com/pester/pester)-repository.
:::
"@

Test-Path $t

Using Test-Path -LiteralPath $t doesn't throw, but maybe better to check if string is a path first?
Haven't really identified the issue as you can solve it by any of these ways:

  • Remove ::: prefix
  • Remove / in the link name
  • Remove square brackets in link (which are wildcard chars, so that makes sense)

[Feature Request] Subfolders

I have a few complex PS modules with 20-60 cmdlets, for the sake of clarity and discoverability we tend to group these by verb. Since discovering this module (phenomenal work btw!) I've added the ability to group cmdlets by verb in the resulting documentation as well as reflecting appropriately in the resulting sidebar with category pages. Would this be a useful addition to PR?

Module not found by name on unix

PS /workspaces/docs> Import-Module Alt3.Docusaurus.PowerShell                                                                                  
Import-Module: The specified module 'Alt3.Docusaurus.PowerShell' was not loaded because no valid module file was found in any module directory.

Works fine by using .psd1 path.

Root cause:
The module folder still use Powershell while the manifest use PowerShell. Renaming the folder solves it. I assume that's because the PSGallery registration is using Powershell. Possible to rename package on PSGallery?

Move powershell code block monicker to PlatyPS

Because PlatyPS does not add the powershell syntax highlighting language to code blocks we are currently adding the monicker ourselves during the markdown-to-mdx transformation, see https://github.com/alt3/Docusaurus.Powershell/blob/master/Source/Private/UpdateContentCodeBlocks.ps1

Ideally... a PR should be made to update PlatyPS so we can drop this step. Green light given by the repo owner, just needs to be done (see PowerShell/platyPS#475 (comment)). Additional background info at PowerShell/platyPS#294

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.