iainbrighton / PScribo

PowerShell documentation framework
MIT License
230 stars 35 forks source link

Feature request: links in paragraphs #112

Open cwidhelm opened 3 years ago

cwidhelm commented 3 years ago

Can you add support for a link tag?

Either in a paragraph or in a text block it would be nice to be able to inline a link $(Link -href "https://google.com" -target _blank -Label {Click Here}) so we can create more dynamic content linking to other resources.

LordFrogprince commented 3 years ago

I just did something where I needed to embed a link to a folder location in an HTML Email that was being generated.

What I did is use the TOC command with Please Click here: $Hyperlink and it did what I need to. The $Hyperlink was G Drive File Location

rebelinux commented 1 year ago

I think this would be a great feature!

Atreidae commented 1 year ago

This would be handy in Tables as well as Paragraphs, As this module is used heavily in AsBuiltReport this would allow us to have a table of configuration items, and then the clickable link to jump to that item.

For example, Say an object is comprised of multiple smaller objects. The table can link to each of those smaller objects.

iainbrighton commented 1 year ago

I think adding external/web links to paragraphs would be a fairly simple implementation.

{
    Paragraph {
        Text 'You can find the PScribo documentation examples'
        Link -Text 'Here' -Uri 'https://github.com/iainbrighton/PScribo/tree/dev/Examples' -Target New
    }
}

Would render this (Markdown doesn't support the target attribute)

You can find the PScribo documentation examples here

Adding them to tables would be a lot more difficult and would need further discussions before any implementation.

iainbrighton commented 1 year ago

This would be handy in Tables as well as Paragraphs, As this module is used heavily in AsBuiltReport this would allow us to have a table of configuration items, and then the clickable link to jump to that item.

For example, Say an object is comprised of multiple smaller objects. The table can link to each of those smaller objects.

@Atreidae you are talking about adding cross-references here - not external/web links? Adding support for this would be fairly straightforward for paragraphs, but a lot more involved for tables (just like with web links). I'll have a think about how it could be implemented.

Atreidae commented 1 year ago

Yes, that's correct, I'm looking for a way to implement similar functionality to tools like AudioCodes Ini file viewer. With, Teams we have several objects that reference other objects (Dial Plans that reference multiple normalization rules, for example), and it's handy to be able to jump from one to another.

For example, see the aforementioned Ini viewer. image

Clicking on this "2" takes us straight to the IP Group section to view the relevant entry. image

As for the link subtype in the new paragraph method, that would still be very handy for references to external documentation.

image

Atreidae commented 1 year ago

Had a play around this afternoon. I'm slowly wrapping my head around how this works. This code is so much more beautiful than mine. Anyway.

I've hacked together a working implementation, just for text files for now, https://github.com/iainbrighton/PScribo/compare/dev...Atreidae:PScribo:dev It takes a Link statement in a paragraph run and adds it via some changes to Out-TextParagraph

Hopefully, I'm sticking with the convention enough, if so, I keep developing and see if I can get it working with Word and HTML for linking to existing anchors.

Atreidae commented 1 year ago

@iainbrighton any thoughts before I keep going?