Skip to content

Support multi-line code blocks in examples - #10776

Merged
Aditya Patwardhan (adityapatwardhan) merged 2 commits into
PowerShell:masterfrom
Greg-Smulko:improve-code-block-recognition-in-examples
Nov 16, 2019
Merged

Aditya Patwardhan (adityapatwardhan) merged 2 commits into
PowerShell:masterfrom
Greg-Smulko:improve-code-block-recognition-in-examples

Conversation

@Greg-Smulko

@Greg-Smulko Greg Smulko (Greg-Smulko) commented Oct 11, 2019 •

Copy link
Copy Markdown
Contributor

PR Summary

Support multi-line code blocks in examples.

PR Context

Fix as asked for by sergei (@vors) in PowerShell/platyPS#180 (comment).
Fixes the issue PowerShell/platyPS#180 Multiline examples don't display as markdown code.

PR Checklist

@Greg-Smulko
Greg Smulko (Greg-Smulko) force-pushed the improve-code-block-recognition-in-examples branch from 2e12760 to 80fb675 Compare October 12, 2019 10:16
@Greg-Smulko Greg Smulko (Greg-Smulko) changed the title WIP: Support multi-line code blocks in examples Support multi-line code blocks in examples Oct 12, 2019
@Greg-Smulko
Greg Smulko (Greg-Smulko) marked this pull request as ready for review October 12, 2019 10:17
@Greg-Smulko
Greg Smulko (Greg-Smulko) force-pushed the improve-code-block-recognition-in-examples branch from 80fb675 to 1af3d7e Compare October 12, 2019 10:21
@iSazonov

Copy link
Copy Markdown
Collaborator

Greg Smulko (@Greg-Smulko) Please rebase to pass Static CI.

@iSazonov Ilya (iSazonov) added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Oct 12, 2019
@iSazonov Ilya (iSazonov) added this to the 7.0.0-preview.5 milestone Oct 12, 2019
@Greg-Smulko
Greg Smulko (Greg-Smulko) force-pushed the improve-code-block-recognition-in-examples branch from 1af3d7e to 9699d50 Compare October 12, 2019 17:24
@iSazonov Ilya (iSazonov) changed the title Support multi-line code blocks in examples WIP: Support multi-line code blocks in examples Oct 12, 2019
@iSazonov

Copy link
Copy Markdown
Collaborator

Add WIP until we get Pester tests.

@Greg-Smulko
Greg Smulko (Greg-Smulko) force-pushed the improve-code-block-recognition-in-examples branch from 9699d50 to c2bac4d Compare October 12, 2019 23:04
@Greg-Smulko Greg Smulko (Greg-Smulko) changed the title WIP: Support multi-line code blocks in examples Support multi-line code blocks in examples Oct 12, 2019
@Greg-Smulko

Copy link
Copy Markdown
Contributor Author

I replaced unit tests with Pester tests, could you take a look again Ilya (@iSazonov)?

@iSazonov

Copy link
Copy Markdown
Collaborator

Greg Smulko (@Greg-Smulko) Could you please check the fix with PlatyPS?

@adityapatwardhan Aditya Patwardhan (adityapatwardhan) added the WG-Interactive-HelpSystem help infrastructure and formatting of help label Oct 15, 2019
@Greg-Smulko
Greg Smulko (Greg-Smulko) force-pushed the improve-code-block-recognition-in-examples branch 2 times, most recently from 552809f to 3c2866e Compare October 18, 2019 16:10
@Greg-Smulko

Copy link
Copy Markdown
Contributor Author

Could you please check the fix with PlatyPS?

Ilya (@iSazonov) , I tested the fix with PlatyPS, everything looks fine. :)
See the files attached.
I generated them using the New-MarkdownHelp and New-ExternalHelp cmdlets.

@iSazonov Ilya (iSazonov) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greg Smulko (@Greg-Smulko) Thanks for confirmation!

I think it would be useful to measure and share a performance degradation since we use Regex now. Could you please do this?

@Greg-Smulko

Copy link
Copy Markdown
Contributor Author

Ilya (@iSazonov) , performance degradation? What degradation?
On master the Measure-Command -Expression { Get-Help Get-Help -examples } took 304 ms, on the new version only 287 ms.

But seriously, it seems that the very first run of Get-Help takes around 300 ms on both versions, and then the subsequent ones (for a different command) about 10-15 ms.

I tried running Measure-Command -Expression { Get-Help Get-Help -examples } (took ~300 ms) and then Measure-Command -Expression { Get-Help Get-Command -examples } (took ~15 ms).

To summarize, I think that there is no visible performance degradation at all, at least for the cmdlets that I tested.

@iSazonov

Copy link
Copy Markdown
Collaborator

Greg Smulko (@Greg-Smulko) Thanks!

Aditya Patwardhan (@adityapatwardhan) Please review the PR.

@Greg-Smulko

Copy link
Copy Markdown
Contributor Author

Hi Aditya Patwardhan (@adityapatwardhan), any hope that you could take a look at this?

@Greg-Smulko
Greg Smulko (Greg-Smulko) force-pushed the improve-code-block-recognition-in-examples branch from 3c2866e to eda675e Compare November 2, 2019 16:02
@adityapatwardhan
Aditya Patwardhan (adityapatwardhan) merged commit f32ae64 into PowerShell:master Nov 16, 2019
@adityapatwardhan

Copy link
Copy Markdown
Member

Greg Smulko (@Greg-Smulko) Thank you for your contribution!

@Greg-Smulko
Greg Smulko (Greg-Smulko) deleted the improve-code-block-recognition-in-examples branch November 16, 2019 19:12
@ghost

Copy link
Copy Markdown

🎉v7.0.0-preview.6 has been released which incorporates this pull request.:tada:

Handy links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log WG-Interactive-HelpSystem help infrastructure and formatting of help

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants