Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow non-links for related links items #164

Closed
splatteredbits opened this issue Jul 1, 2016 · 3 comments
Closed

Allow non-links for related links items #164

splatteredbits opened this issue Jul 1, 2016 · 3 comments
Assignees
Milestone

Comments

@splatteredbits
Copy link

Items in the related links section are required to be links. Many of my module's links point to other, related commands in the module. This is similar to PowerShell's own help, where only the names of commands are given in the related links section.

For example, here is Get-ChildItem cmdlet's related links section:

    Online Version: http://go.microsoft.com/fwlink/p/?linkid=290488
    Get-Item 
    Get-Location 
    Get-Process 
    about_Providers

Steps to reproduce

Create a new markdown help file. In the Related Links section add an item that is just the name of a cmdlet:

    # RELATED LINKS

    Use-ACommandName

Run the New-ExternalHelp command to convert the above help to MAML. Note you get this error:

Exception calling "NodeModelToMamlModel" with "1" argument(s): "254:532 'Use-ACommandName
'
 Expect hyperlink, but got Add-Index"
At C:\Program Files\WindowsPowerShell\Modules\platyPS\0.5.0\platyPS.psm1:973 char:9
+         $maml = $t.NodeModelToMamlModel($model)
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : HelpSchemaException

Expected behavior

I expect to be able to use just command names for items in the Related Links section.

Actual behavior

I can't use just command names for items in the Related Links section.

Environment data

v0.5.0

@jongeller
Copy link
Contributor

jongeller commented Jul 10, 2016

@splatteredbits this is a function of the help system built into PowerShell. The first related link in MAML must be a valid URI. If the first link is not a URI the help system throws an error when it tries to parse MAML. This is to support the functionality of Get-Help <Some-Cmdlet> -online where the first related link is used to open a webpage in browser.

When converting from MAML to MD we updated the code to allow bad URIs to convert to MD to avoid throwing this error in MD generation.

If you have populated the Metadata for online version (which populates the first related link item when converting to external help) like this:

---
online version: https://github.com/PowerShell/platyPS/blob/master/docs/Get-HelpPreview.md
---

and are still experiencing the issue, we can investigate.

@vors
Copy link
Collaborator

vors commented Jul 11, 2016

It's a variation of #140.

I don't think platyPS should support a plain text in RELATED LINKS section. But it should support relative links and so on.

@splatteredbits you should be able to use [Use-ACommandName]()
Note that what do you see in the Get-Help output is just a representation of the help object on the screen.

Take your example with Get-Help Get-ChildItem:

PS C:\> $h = Get-Help Get-ChildItem
PS C:\> $h.relatedLinks.navigationLink

uri                                             linkText
---                                             --------
http://go.microsoft.com/fwlink/p/?linkid=290488 Online Version:
                                                Get-Item
                                                Get-Location
                                                Get-Process
                                                about_Providers

Not a plain text either: links with empty uri.

@vors vors added the wontfix label Jul 11, 2016
@vors vors added this to the 0.7.0 milestone Jul 13, 2016
@vors vors self-assigned this Jul 13, 2016
@vors
Copy link
Collaborator

vors commented Jul 13, 2016

Fixed in 8931129

@vors vors closed this as completed Jul 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants