diff --git a/PowerShell.sln b/PowerShell.sln
index b164361d7d..224d27ab3f 100644
--- a/PowerShell.sln
+++ b/PowerShell.sln
@@ -1,5 +1,5 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
+# Visual Studio Version 16
# https://github.com/dotnet/project-system/blob/master/docs/opening-with-new-project-system.md#project-type-guids
VisualStudioVersion = 15.0.26730.12
MinimumVisualStudioVersion = 10.0.40219.1
@@ -29,8 +29,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.WSMan.Runtime", "
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "powershell-unix", "src\powershell-unix\powershell-unix.csproj", "{73EA0BE6-C0C5-4B56-A5AA-DADA4C01D690}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.PowerShell.MarkdownRender", "src\Microsoft.PowerShell.MarkdownRender\Microsoft.PowerShell.MarkdownRender.csproj", "{43D4F8DA-A7DE-494B-81B0-BDE3CFD7B1F1}"
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "xUnit.tests", "test\xUnit\xUnit.tests.csproj", "{08704934-9764-48CE-86DB-BCF0A1CF7899}"
EndProject
# Configuration mapping comment
diff --git a/assets/files.wxs b/assets/files.wxs
index 418a32db37..199e964fe1 100644
--- a/assets/files.wxs
+++ b/assets/files.wxs
@@ -1163,9 +1163,6 @@
-
-
-
@@ -3451,7 +3448,6 @@
-
diff --git a/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj b/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj
index 3ce6232894..b6f1bbaf63 100644
--- a/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj
+++ b/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj
@@ -8,7 +8,7 @@
-
+
diff --git a/src/Microsoft.PowerShell.MarkdownRender/CodeInlineRenderer.cs b/src/Microsoft.PowerShell.MarkdownRender/CodeInlineRenderer.cs
deleted file mode 100644
index f3dc651bd4..0000000000
--- a/src/Microsoft.PowerShell.MarkdownRender/CodeInlineRenderer.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-
-using Markdig.Syntax.Inlines;
-
-namespace Microsoft.PowerShell.MarkdownRender
-{
- ///
- /// Renderer for adding VT100 escape sequences for inline code elements.
- ///
- internal class CodeInlineRenderer : VT100ObjectRenderer
- {
- protected override void Write(VT100Renderer renderer, CodeInline obj)
- {
- renderer.Write(renderer.EscapeSequences.FormatCode(obj.Content, isInline: true));
- }
- }
-}
diff --git a/src/Microsoft.PowerShell.MarkdownRender/EmphasisInlineRenderer.cs b/src/Microsoft.PowerShell.MarkdownRender/EmphasisInlineRenderer.cs
deleted file mode 100644
index 95a2bd1c7e..0000000000
--- a/src/Microsoft.PowerShell.MarkdownRender/EmphasisInlineRenderer.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-
-using Markdig.Syntax.Inlines;
-
-namespace Microsoft.PowerShell.MarkdownRender
-{
- ///
- /// Renderer for adding VT100 escape sequences for bold and italics elements.
- ///
- internal class EmphasisInlineRenderer : VT100ObjectRenderer
- {
- protected override void Write(VT100Renderer renderer, EmphasisInline obj)
- {
- renderer.Write(renderer.EscapeSequences.FormatEmphasis(obj.FirstChild.ToString(), isBold: obj.DelimiterCount == 2));
- }
- }
-}
diff --git a/src/Microsoft.PowerShell.MarkdownRender/FencedCodeBlockRenderer.cs b/src/Microsoft.PowerShell.MarkdownRender/FencedCodeBlockRenderer.cs
deleted file mode 100644
index d878ae922d..0000000000
--- a/src/Microsoft.PowerShell.MarkdownRender/FencedCodeBlockRenderer.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-
-using System;
-using Markdig.Helpers;
-using Markdig.Syntax;
-
-namespace Microsoft.PowerShell.MarkdownRender
-{
- ///
- /// Renderer for adding VT100 escape sequences for code blocks with language type.
- ///
- internal class FencedCodeBlockRenderer : VT100ObjectRenderer
- {
- protected override void Write(VT100Renderer renderer, FencedCodeBlock obj)
- {
- if (obj?.Lines.Lines != null)
- {
- foreach (StringLine codeLine in obj.Lines.Lines)
- {
- if (!string.IsNullOrWhiteSpace(codeLine.ToString()))
- {
- // If the code block is of type YAML, then tab to right to improve readability.
- // This specifically helps for parameters help content.
- if (string.Equals(obj.Info, "yaml", StringComparison.OrdinalIgnoreCase))
- {
- renderer.Write("\t").WriteLine(codeLine.ToString());
- }
- else
- {
- renderer.WriteLine(renderer.EscapeSequences.FormatCode(codeLine.ToString(), isInline: false));
- }
- }
- }
-
- // Add a blank line after the code block for better readability.
- renderer.WriteLine();
- }
- }
- }
-}
diff --git a/src/Microsoft.PowerShell.MarkdownRender/HeaderBlockRenderer.cs b/src/Microsoft.PowerShell.MarkdownRender/HeaderBlockRenderer.cs
deleted file mode 100644
index 454000acc5..0000000000
--- a/src/Microsoft.PowerShell.MarkdownRender/HeaderBlockRenderer.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-
-using Markdig.Syntax;
-
-namespace Microsoft.PowerShell.MarkdownRender
-{
- ///
- /// Renderer for adding VT100 escape sequences for headings.
- ///
- internal class HeaderBlockRenderer : VT100ObjectRenderer
- {
- protected override void Write(VT100Renderer renderer, HeadingBlock obj)
- {
- string headerText = obj?.Inline?.FirstChild?.ToString();
-
- if (!string.IsNullOrEmpty(headerText))
- {
- // Format header and then add blank line to improve readability.
- switch (obj.Level)
- {
- case 1:
- renderer.WriteLine(renderer.EscapeSequences.FormatHeader1(headerText));
- renderer.WriteLine();
- break;
-
- case 2:
- renderer.WriteLine(renderer.EscapeSequences.FormatHeader2(headerText));
- renderer.WriteLine();
- break;
-
- case 3:
- renderer.WriteLine(renderer.EscapeSequences.FormatHeader3(headerText));
- renderer.WriteLine();
- break;
-
- case 4:
- renderer.WriteLine(renderer.EscapeSequences.FormatHeader4(headerText));
- renderer.WriteLine();
- break;
-
- case 5:
- renderer.WriteLine(renderer.EscapeSequences.FormatHeader5(headerText));
- renderer.WriteLine();
- break;
-
- case 6:
- renderer.WriteLine(renderer.EscapeSequences.FormatHeader6(headerText));
- renderer.WriteLine();
- break;
- }
- }
- }
- }
-}
diff --git a/src/Microsoft.PowerShell.MarkdownRender/LeafInlineRenderer.cs b/src/Microsoft.PowerShell.MarkdownRender/LeafInlineRenderer.cs
deleted file mode 100644
index d1af034879..0000000000
--- a/src/Microsoft.PowerShell.MarkdownRender/LeafInlineRenderer.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-
-using Markdig.Syntax.Inlines;
-
-namespace Microsoft.PowerShell.MarkdownRender
-{
- ///
- /// Renderer for adding VT100 escape sequences for leaf elements like plain text in paragraphs.
- ///
- internal class LeafInlineRenderer : VT100ObjectRenderer
- {
- protected override void Write(VT100Renderer renderer, LeafInline obj)
- {
- // If the next sibling is null, then this is the last line in the paragraph.
- // Add new line character at the end.
- // Else just write without newline at the end.
- if (obj.NextSibling == null)
- {
- renderer.WriteLine(obj.ToString());
- }
- else
- {
- renderer.Write(obj.ToString());
- }
- }
- }
-}
diff --git a/src/Microsoft.PowerShell.MarkdownRender/LineBreakRenderer.cs b/src/Microsoft.PowerShell.MarkdownRender/LineBreakRenderer.cs
deleted file mode 100644
index 11f1cf08ec..0000000000
--- a/src/Microsoft.PowerShell.MarkdownRender/LineBreakRenderer.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-
-using Markdig.Syntax.Inlines;
-
-namespace Microsoft.PowerShell.MarkdownRender
-{
- ///
- /// Renderer for adding VT100 escape sequences for line breaks.
- ///
- internal class LineBreakRenderer : VT100ObjectRenderer
- {
- protected override void Write(VT100Renderer renderer, LineBreakInline obj)
- {
- // If it is a hard line break add new line at the end.
- // Else, add a space for after the last character to improve readability.
- if (obj.IsHard)
- {
- renderer.WriteLine();
- }
- else
- {
- renderer.Write(" ");
- }
- }
- }
-}
diff --git a/src/Microsoft.PowerShell.MarkdownRender/LinkInlineRenderer.cs b/src/Microsoft.PowerShell.MarkdownRender/LinkInlineRenderer.cs
deleted file mode 100644
index e4b11f1331..0000000000
--- a/src/Microsoft.PowerShell.MarkdownRender/LinkInlineRenderer.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-
-using Markdig.Syntax.Inlines;
-
-namespace Microsoft.PowerShell.MarkdownRender
-{
- ///
- /// Renderer for adding VT100 escape sequences for links.
- ///
- internal class LinkInlineRenderer : VT100ObjectRenderer
- {
- protected override void Write(VT100Renderer renderer, LinkInline obj)
- {
- string text = obj.FirstChild?.ToString();
-
- // Format link as image or link.
- if (obj.IsImage)
- {
- renderer.Write(renderer.EscapeSequences.FormatImage(text));
- }
- else
- {
- renderer.Write(renderer.EscapeSequences.FormatLink(text, obj.Url));
- }
- }
- }
-}
diff --git a/src/Microsoft.PowerShell.MarkdownRender/ListBlockRenderer.cs b/src/Microsoft.PowerShell.MarkdownRender/ListBlockRenderer.cs
deleted file mode 100644
index 100565ba86..0000000000
--- a/src/Microsoft.PowerShell.MarkdownRender/ListBlockRenderer.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-
-using Markdig.Syntax;
-
-namespace Microsoft.PowerShell.MarkdownRender
-{
- ///
- /// Renderer for adding VT100 escape sequences for list blocks.
- ///
- internal class ListBlockRenderer : VT100ObjectRenderer
- {
- protected override void Write(VT100Renderer renderer, ListBlock obj)
- {
- // start index of a numbered block.
- int index = 1;
-
- foreach (var item in obj)
- {
- if (item is ListItemBlock listItem)
- {
- if (obj.IsOrdered)
- {
- RenderNumberedList(renderer, listItem, index++);
- }
- else
- {
- renderer.Write(listItem);
- }
- }
- }
-
- renderer.WriteLine();
- }
-
- private static void RenderNumberedList(VT100Renderer renderer, ListItemBlock block, int index)
- {
- // For a numbered list, we need to make sure the index is incremented.
- foreach (var line in block)
- {
- if (line is ParagraphBlock paragraphBlock)
- {
- renderer.Write(index.ToString()).Write(". ").Write(paragraphBlock.Inline);
- }
- }
- }
- }
-}
diff --git a/src/Microsoft.PowerShell.MarkdownRender/ListItemBlockRenderer.cs b/src/Microsoft.PowerShell.MarkdownRender/ListItemBlockRenderer.cs
deleted file mode 100644
index 6eb356b3db..0000000000
--- a/src/Microsoft.PowerShell.MarkdownRender/ListItemBlockRenderer.cs
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-
-using System.Threading;
-using Markdig.Syntax;
-
-namespace Microsoft.PowerShell.MarkdownRender
-{
- ///
- /// Renderer for adding VT100 escape sequences for items in a list block.
- ///
- internal class ListItemBlockRenderer : VT100ObjectRenderer
- {
- protected override void Write(VT100Renderer renderer, ListItemBlock obj)
- {
- if (obj.Parent is ListBlock parent)
- {
- if (!parent.IsOrdered)
- {
- foreach (var line in obj)
- {
- RenderWithIndent(renderer, line, parent.BulletType, 0);
- }
- }
- }
- }
-
- private void RenderWithIndent(VT100Renderer renderer, MarkdownObject block, char listBullet, int indentLevel)
- {
- // Indent left by 2 for each level on list.
- string indent = Padding(indentLevel * 2);
-
- if (block is ParagraphBlock paragraphBlock)
- {
- renderer.Write(indent).Write(listBullet).Write(" ").Write(paragraphBlock.Inline);
- }
- else
- {
- // If there is a sublist, the block is a ListBlock instead of ParagraphBlock.
- if (block is ListBlock subList)
- {
- foreach (var subListItem in subList)
- {
- if (subListItem is ListItemBlock subListItemBlock)
- {
- foreach (var line in subListItemBlock)
- {
- // Increment indent level for sub list.
- RenderWithIndent(renderer, line, listBullet, indentLevel + 1);
- }
- }
- }
- }
- }
- }
-
- // Typical padding is at most a screen's width, any more than that and we won't bother caching.
- private const int IndentCacheMax = 120;
-
- private static readonly string[] IndentCache = new string[IndentCacheMax];
-
- internal static string Padding(int countOfSpaces)
- {
- if (countOfSpaces >= IndentCacheMax)
- {
- return new string(' ', countOfSpaces);
- }
-
- var result = IndentCache[countOfSpaces];
-
- if (result == null)
- {
- Interlocked.CompareExchange(ref IndentCache[countOfSpaces], new string(' ', countOfSpaces), comparand: null);
- result = IndentCache[countOfSpaces];
- }
-
- return result;
- }
- }
-}
diff --git a/src/Microsoft.PowerShell.MarkdownRender/MarkdownConverter.cs b/src/Microsoft.PowerShell.MarkdownRender/MarkdownConverter.cs
deleted file mode 100644
index bb4a3e8a84..0000000000
--- a/src/Microsoft.PowerShell.MarkdownRender/MarkdownConverter.cs
+++ /dev/null
@@ -1,90 +0,0 @@
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-
-using System;
-using System.IO;
-
-using Markdig;
-
-namespace Microsoft.PowerShell.MarkdownRender
-{
- ///
- /// Type of conversion from Markdown.
- ///
- [Flags]
- public enum MarkdownConversionType
- {
- ///
- /// Convert to HTML.
- ///
- HTML = 1,
-
- ///
- /// Convert to VT100 encoded string.
- ///
- VT100 = 2
- }
-
- ///
- /// Object representing the conversion from Markdown.
- ///
- public class MarkdownInfo
- {
- ///
- /// Gets the Html content after conversion.
- ///
- public string Html { get; internal set; }
-
- ///
- /// Gets the VT100 encoded string after conversion.
- ///
- public string VT100EncodedString { get; internal set; }
-
- ///
- /// Gets the AST of the Markdown string.
- ///
- public Markdig.Syntax.MarkdownDocument Tokens { get; internal set; }
- }
-
- ///
- /// Class to convert a Markdown string to VT100, HTML or AST.
- ///
- public sealed class MarkdownConverter
- {
- ///
- /// Convert from Markdown string to VT100 encoded string or HTML. Returns MarkdownInfo object.
- ///
- /// String with Markdown content to be converted.
- /// Specifies type of conversion, either VT100 or HTML.
- /// Specifies the rendering options for VT100 rendering.
- /// MarkdownInfo object with the converted output.
- public static MarkdownInfo Convert(string markdownString, MarkdownConversionType conversionType, PSMarkdownOptionInfo optionInfo)
- {
- var renderInfo = new MarkdownInfo();
- var writer = new StringWriter();
- MarkdownPipeline pipeline = null;
-
- if (conversionType.HasFlag(MarkdownConversionType.HTML))
- {
- pipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().Build();
- var renderer = new Markdig.Renderers.HtmlRenderer(writer);
- renderInfo.Html = Markdig.Markdown.Convert(markdownString, renderer, pipeline).ToString();
- }
-
- if (conversionType.HasFlag(MarkdownConversionType.VT100))
- {
- pipeline = new MarkdownPipelineBuilder().Build();
-
- // Use the VT100 renderer.
- var renderer = new VT100Renderer(writer, optionInfo);
- renderInfo.VT100EncodedString = Markdig.Markdown.Convert(markdownString, renderer, pipeline).ToString();
- }
-
- // Always have AST available.
- var parsed = Markdig.Markdown.Parse(markdownString, pipeline);
- renderInfo.Tokens = parsed;
-
- return renderInfo;
- }
- }
-}
diff --git a/src/Microsoft.PowerShell.MarkdownRender/Microsoft.PowerShell.MarkdownRender.csproj b/src/Microsoft.PowerShell.MarkdownRender/Microsoft.PowerShell.MarkdownRender.csproj
deleted file mode 100644
index 9cab5ee5e0..0000000000
--- a/src/Microsoft.PowerShell.MarkdownRender/Microsoft.PowerShell.MarkdownRender.csproj
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
- PowerShell's Markdown Rendering project
- Microsoft.PowerShell.MarkdownRender
-
-
-
-
-
-
-
-
-
diff --git a/src/Microsoft.PowerShell.MarkdownRender/ParagraphBlockRenderer.cs b/src/Microsoft.PowerShell.MarkdownRender/ParagraphBlockRenderer.cs
deleted file mode 100644
index 3b854cb218..0000000000
--- a/src/Microsoft.PowerShell.MarkdownRender/ParagraphBlockRenderer.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-
-using Markdig.Syntax;
-
-namespace Microsoft.PowerShell.MarkdownRender
-{
- ///
- /// Renderer for adding VT100 escape sequences for paragraphs.
- ///
- internal class ParagraphBlockRenderer : VT100ObjectRenderer
- {
- protected override void Write(VT100Renderer renderer, ParagraphBlock obj)
- {
- // Call the renderer for children, leaf inline or line breaks.
- renderer.WriteChildren(obj.Inline);
-
- // Add new line at the end of the paragraph.
- renderer.WriteLine();
- }
- }
-}
diff --git a/src/Microsoft.PowerShell.MarkdownRender/QuoteBlockRenderer.cs b/src/Microsoft.PowerShell.MarkdownRender/QuoteBlockRenderer.cs
deleted file mode 100644
index 7e0bda6bda..0000000000
--- a/src/Microsoft.PowerShell.MarkdownRender/QuoteBlockRenderer.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-
-using Markdig.Syntax;
-
-namespace Microsoft.PowerShell.MarkdownRender
-{
- ///
- /// Renderer for adding VT100 escape sequences for quote blocks.
- ///
- internal class QuoteBlockRenderer : VT100ObjectRenderer
- {
- protected override void Write(VT100Renderer renderer, QuoteBlock obj)
- {
- // Iterate through each item and add the quote character before the content.
- foreach (var item in obj)
- {
- renderer.Write(obj.QuoteChar).Write(" ").Write(item);
- }
-
- // Add blank line after the quote block.
- renderer.WriteLine();
- }
- }
-}
diff --git a/src/Microsoft.PowerShell.MarkdownRender/VT100EscapeSequences.cs b/src/Microsoft.PowerShell.MarkdownRender/VT100EscapeSequences.cs
deleted file mode 100644
index 311522ac0a..0000000000
--- a/src/Microsoft.PowerShell.MarkdownRender/VT100EscapeSequences.cs
+++ /dev/null
@@ -1,478 +0,0 @@
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-
-using System;
-using System.Management.Automation;
-
-namespace Microsoft.PowerShell.MarkdownRender
-{
- ///
- /// Enum to name all the properties of PSMarkdownOptionInfo.
- ///
- public enum MarkdownOptionInfoProperty
- {
- ///
- /// Property name Header1.
- ///
- Header1,
-
- ///
- /// Property name Header2.
- ///
- Header2,
-
- ///
- /// Property name Header3.
- ///
- Header3,
-
- ///
- /// Property name Header4.
- ///
- Header4,
-
- ///
- /// Property name Header5.
- ///
- Header5,
-
- ///
- /// Property name Header6.
- ///
- Header6,
-
- ///
- /// Property name Code.
- ///
- Code,
-
- ///
- /// Property name Link.
- ///
- Link,
-
- ///
- /// Property name Image.
- ///
- Image,
-
- ///
- /// Property name EmphasisBold.
- ///
- EmphasisBold,
-
- ///
- /// Property name EmphasisItalics.
- ///
- EmphasisItalics
- }
-
- ///
- /// Class to represent color preference options for various Markdown elements.
- ///
- public sealed class PSMarkdownOptionInfo
- {
- private const char Esc = (char)0x1b;
- private const string EndSequence = "[0m";
-
- ///
- /// Gets or sets current VT100 escape sequence for header 1.
- ///
- public string Header1 { get; set; }
-
- ///
- /// Gets or sets current VT100 escape sequence for header 2.
- ///
- public string Header2 { get; set; }
-
- ///
- /// Gets or sets current VT100 escape sequence for header 3.
- ///
- public string Header3 { get; set; }
-
- ///
- /// Gets or sets current VT100 escape sequence for header 4.
- ///
- public string Header4 { get; set; }
-
- ///
- /// Gets or sets current VT100 escape sequence for header 5.
- ///
- public string Header5 { get; set; }
-
- ///
- /// Gets or sets current VT100 escape sequence for header 6.
- ///
- public string Header6 { get; set; }
-
- ///
- /// Gets or sets current VT100 escape sequence for code inline and code blocks.
- ///
- public string Code { get; set; }
-
- ///
- /// Gets or sets current VT100 escape sequence for links.
- ///
- public string Link { get; set; }
-
- ///
- /// Gets or sets current VT100 escape sequence for images.
- ///
- public string Image { get; set; }
-
- ///
- /// Gets or sets current VT100 escape sequence for bold text.
- ///
- public string EmphasisBold { get; set; }
-
- ///
- /// Gets or sets current VT100 escape sequence for italics text.
- ///
- public string EmphasisItalics { get; set; }
-
- ///
- /// Gets or sets a value indicating whether VT100 escape sequences should be added. Default it true.
- ///
- public bool EnableVT100Encoding { get; set; }
-
- ///
- /// Get the property as an rendered escape sequence.
- /// This is used by formatting system for displaying.
- ///
- /// Name of the property to get as escape sequence.
- /// Specified property name as escape sequence.
- public string AsEscapeSequence(MarkdownOptionInfoProperty propertyName)
- {
- switch (propertyName)
- {
- case MarkdownOptionInfoProperty.Header1:
- return string.Concat(Esc, Header1, Header1, Esc, EndSequence);
-
- case MarkdownOptionInfoProperty.Header2:
- return string.Concat(Esc, Header2, Header2, Esc, EndSequence);
-
- case MarkdownOptionInfoProperty.Header3:
- return string.Concat(Esc, Header3, Header3, Esc, EndSequence);
-
- case MarkdownOptionInfoProperty.Header4:
- return string.Concat(Esc, Header4, Header4, Esc, EndSequence);
-
- case MarkdownOptionInfoProperty.Header5:
- return string.Concat(Esc, Header5, Header5, Esc, EndSequence);
-
- case MarkdownOptionInfoProperty.Header6:
- return string.Concat(Esc, Header6, Header6, Esc, EndSequence);
-
- case MarkdownOptionInfoProperty.Code:
- return string.Concat(Esc, Code, Code, Esc, EndSequence);
-
- case MarkdownOptionInfoProperty.Link:
- return string.Concat(Esc, Link, Link, Esc, EndSequence);
-
- case MarkdownOptionInfoProperty.Image:
- return string.Concat(Esc, Image, Image, Esc, EndSequence);
-
- case MarkdownOptionInfoProperty.EmphasisBold:
- return string.Concat(Esc, EmphasisBold, EmphasisBold, Esc, EndSequence);
-
- case MarkdownOptionInfoProperty.EmphasisItalics:
- return string.Concat(Esc, EmphasisItalics, EmphasisItalics, Esc, EndSequence);
-
- default:
- break;
- }
-
- return null;
- }
-
- ///
- /// Initializes a new instance of the class and sets dark as the default theme.
- ///
- public PSMarkdownOptionInfo()
- {
- SetDarkTheme();
- EnableVT100Encoding = true;
- }
-
- private const string Header1Dark = "[7m";
- private const string Header2Dark = "[4;93m";
- private const string Header3Dark = "[4;94m";
- private const string Header4Dark = "[4;95m";
- private const string Header5Dark = "[4;96m";
- private const string Header6Dark = "[4;97m";
- private const string CodeDark = "[48;2;155;155;155;38;2;30;30;30m";
- private const string CodeMacOS = "[107;95m";
- private const string LinkDark = "[4;38;5;117m";
- private const string ImageDark = "[33m";
- private const string EmphasisBoldDark = "[1m";
- private const string EmphasisItalicsDark = "[36m";
-
- private const string Header1Light = "[7m";
- private const string Header2Light = "[4;33m";
- private const string Header3Light = "[4;34m";
- private const string Header4Light = "[4;35m";
- private const string Header5Light = "[4;36m";
- private const string Header6Light = "[4;30m";
- private const string CodeLight = "[48;2;155;155;155;38;2;30;30;30m";
- private const string LinkLight = "[4;38;5;117m";
- private const string ImageLight = "[33m";
- private const string EmphasisBoldLight = "[1m";
- private const string EmphasisItalicsLight = "[36m";
-
- ///
- /// Set all preference for dark theme.
- ///
- public void SetDarkTheme()
- {
- Header1 = Header1Dark;
- Header2 = Header2Dark;
- Header3 = Header3Dark;
- Header4 = Header4Dark;
- Header5 = Header5Dark;
- Header6 = Header6Dark;
- Link = LinkDark;
- Image = ImageDark;
- EmphasisBold = EmphasisBoldDark;
- EmphasisItalics = EmphasisItalicsDark;
- SetCodeColor(isDarkTheme: true);
- }
-
- ///
- /// Set all preference for light theme.
- ///
- public void SetLightTheme()
- {
- Header1 = Header1Light;
- Header2 = Header2Light;
- Header3 = Header3Light;
- Header4 = Header4Light;
- Header5 = Header5Light;
- Header6 = Header6Light;
- Link = LinkLight;
- Image = ImageLight;
- EmphasisBold = EmphasisBoldLight;
- EmphasisItalics = EmphasisItalicsLight;
- SetCodeColor(isDarkTheme: false);
- }
-
- private void SetCodeColor(bool isDarkTheme)
- {
- // MacOS terminal app does not support extended colors for VT100, so we special case for it.
- Code = Platform.IsMacOS ? CodeMacOS : isDarkTheme ? CodeDark : CodeLight;
- }
- }
-
- ///
- /// Class to represent default VT100 escape sequences.
- ///
- public class VT100EscapeSequences
- {
- private const char Esc = (char)0x1B;
-
- private readonly string endSequence = Esc + "[0m";
-
- // For code blocks, [500@ make sure that the whole line has background color.
- private const string LongBackgroundCodeBlock = "[500@";
-
- private readonly PSMarkdownOptionInfo options;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// PSMarkdownOptionInfo object to initialize with.
- public VT100EscapeSequences(PSMarkdownOptionInfo optionInfo)
- {
- if (optionInfo == null)
- {
- throw new ArgumentNullException(nameof(optionInfo));
- }
-
- options = optionInfo;
- }
-
- ///
- /// Class to represent default VT100 escape sequences.
- ///
- /// Text of the header to format.
- /// Formatted Header 1 string.
- public string FormatHeader1(string headerText)
- {
- return FormatHeader(headerText, options.Header1);
- }
-
- ///
- /// Class to represent default VT100 escape sequences.
- ///
- /// Text of the header to format.
- /// Formatted Header 2 string.
- public string FormatHeader2(string headerText)
- {
- return FormatHeader(headerText, options.Header2);
- }
-
- ///
- /// Class to represent default VT100 escape sequences.
- ///
- /// Text of the header to format.
- /// Formatted Header 3 string.
- public string FormatHeader3(string headerText)
- {
- return FormatHeader(headerText, options.Header3);
- }
-
- ///
- /// Class to represent default VT100 escape sequences.
- ///
- /// Text of the header to format.
- /// Formatted Header 4 string.
- public string FormatHeader4(string headerText)
- {
- return FormatHeader(headerText, options.Header4);
- }
-
- ///
- /// Class to represent default VT100 escape sequences.
- ///
- /// Text of the header to format.
- /// Formatted Header 5 string.
- public string FormatHeader5(string headerText)
- {
- return FormatHeader(headerText, options.Header5);
- }
-
- ///
- /// Class to represent default VT100 escape sequences.
- ///
- /// Text of the header to format.
- /// Formatted Header 6 string.
- public string FormatHeader6(string headerText)
- {
- return FormatHeader(headerText, options.Header6);
- }
-
- ///
- /// Class to represent default VT100 escape sequences.
- ///
- /// Text of the code block to format.
- /// True if it is a inline code block, false otherwise.
- /// Formatted code block string.
- public string FormatCode(string codeText, bool isInline)
- {
- bool isVT100Enabled = options.EnableVT100Encoding;
-
- if (isInline)
- {
- if (isVT100Enabled)
- {
- return string.Concat(Esc, options.Code, codeText, endSequence);
- }
- else
- {
- return codeText;
- }
- }
- else
- {
- if (isVT100Enabled)
- {
- return string.Concat(Esc, options.Code, codeText, Esc, LongBackgroundCodeBlock, endSequence);
- }
- else
- {
- return codeText;
- }
- }
- }
-
- ///
- /// Class to represent default VT100 escape sequences.
- ///
- /// Text of the link to format.
- /// URL of the link.
- /// True url should be hidden, false otherwise. Default is true.
- /// Formatted link string.
- public string FormatLink(string linkText, string url, bool hideUrl = true)
- {
- bool isVT100Enabled = options.EnableVT100Encoding;
-
- if (hideUrl)
- {
- if (isVT100Enabled)
- {
- return string.Concat(Esc, options.Link, "\"", linkText, "\"", endSequence);
- }
- else
- {
- return string.Concat("\"", linkText, "\"");
- }
- }
- else
- {
- if (isVT100Enabled)
- {
- return string.Concat("\"", linkText, "\" (", Esc, options.Link, url, endSequence, ")");
- }
- else
- {
- return string.Concat("\"", linkText, "\" (", url, ")");
- }
- }
- }
-
- ///
- /// Class to represent default VT100 escape sequences.
- ///
- /// Text to format as emphasis.
- /// True if it is to be formatted as bold, false to format it as italics.
- /// Formatted emphasis string.
- public string FormatEmphasis(string emphasisText, bool isBold)
- {
- var sequence = isBold ? options.EmphasisBold : options.EmphasisItalics;
-
- if (options.EnableVT100Encoding)
- {
- return string.Concat(Esc, sequence, emphasisText, endSequence);
- }
- else
- {
- return emphasisText;
- }
- }
-
- ///
- /// Class to represent default VT100 escape sequences.
- ///
- /// Text of the image to format.
- /// Formatted image string.
- public string FormatImage(string altText)
- {
- var text = altText;
-
- if (string.IsNullOrEmpty(altText))
- {
- text = "Image";
- }
-
- if (options.EnableVT100Encoding)
- {
- return string.Concat(Esc, options.Image, "[", text, "]", endSequence);
- }
- else
- {
- return string.Concat("[", text, "]");
- }
- }
-
- private string FormatHeader(string headerText, string headerEscapeSequence)
- {
- if (options.EnableVT100Encoding)
- {
- return string.Concat(Esc, headerEscapeSequence, headerText, endSequence);
- }
- else
- {
- return headerText;
- }
- }
- }
-}
diff --git a/src/Microsoft.PowerShell.MarkdownRender/VT100ObjectRenderer.cs b/src/Microsoft.PowerShell.MarkdownRender/VT100ObjectRenderer.cs
deleted file mode 100644
index 916999ecf7..0000000000
--- a/src/Microsoft.PowerShell.MarkdownRender/VT100ObjectRenderer.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-
-using Markdig.Renderers;
-using Markdig.Syntax;
-
-namespace Microsoft.PowerShell.MarkdownRender
-{
- ///
- /// Implement the MarkdownObjectRenderer with VT100Renderer.
- ///
- /// The element type of the renderer.
- public abstract class VT100ObjectRenderer : MarkdownObjectRenderer where T : MarkdownObject
- {
- }
-}
diff --git a/src/Microsoft.PowerShell.MarkdownRender/VT100Renderer.cs b/src/Microsoft.PowerShell.MarkdownRender/VT100Renderer.cs
deleted file mode 100644
index 1f5da6270d..0000000000
--- a/src/Microsoft.PowerShell.MarkdownRender/VT100Renderer.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-
-using System.IO;
-using Markdig.Renderers;
-
-namespace Microsoft.PowerShell.MarkdownRender
-{
- ///
- /// Initializes an instance of the VT100 renderer.
- ///
- public sealed class VT100Renderer : TextRendererBase
- {
- ///
- /// Initializes a new instance of the class.
- ///
- /// TextWriter to write to.
- /// PSMarkdownOptionInfo object with options.
- public VT100Renderer(TextWriter writer, PSMarkdownOptionInfo optionInfo) : base(writer)
- {
- EscapeSequences = new VT100EscapeSequences(optionInfo);
-
- // Add the various element renderers.
- ObjectRenderers.Add(new HeaderBlockRenderer());
- ObjectRenderers.Add(new LineBreakRenderer());
- ObjectRenderers.Add(new CodeInlineRenderer());
- ObjectRenderers.Add(new FencedCodeBlockRenderer());
- ObjectRenderers.Add(new EmphasisInlineRenderer());
- ObjectRenderers.Add(new ParagraphBlockRenderer());
- ObjectRenderers.Add(new LeafInlineRenderer());
- ObjectRenderers.Add(new LinkInlineRenderer());
- ObjectRenderers.Add(new ListBlockRenderer());
- ObjectRenderers.Add(new ListItemBlockRenderer());
- ObjectRenderers.Add(new QuoteBlockRenderer());
- }
-
- ///
- /// Gets the current escape sequences.
- ///
- public VT100EscapeSequences EscapeSequences { get; }
- }
-}
diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1
index ec9c24e20c..aaaee8688d 100644
--- a/tools/packaging/packaging.psm1
+++ b/tools/packaging/packaging.psm1
@@ -1825,8 +1825,7 @@ function New-ILNugetPackage
"Microsoft.PowerShell.SDK.dll",
"Microsoft.WSMan.Management.dll",
"Microsoft.WSMan.Runtime.dll",
- "System.Management.Automation.dll",
- "Microsoft.PowerShell.MarkdownRender.dll")
+ "System.Management.Automation.dll")
$linuxExceptionList = @(
"Microsoft.Management.Infrastructure.CimCmdlets.dll",
@@ -1934,7 +1933,6 @@ function New-ILNugetPackage
'Microsoft.PowerShell.Commands.Utility' {
$deps.Add([tuple]::Create([tuple]::Create('id', 'System.Management.Automation'), [tuple]::Create('version', $PackageVersion))) > $null
- $deps.Add([tuple]::Create([tuple]::Create('id', 'Microsoft.PowerShell.MarkdownRender'), [tuple]::Create('version', $PackageVersion))) > $null
foreach($packageInfo in (Get-ProjectPackageInformation -ProjectName $fileBaseName))
{
@@ -1996,14 +1994,6 @@ function New-ILNugetPackage
$deps.Add([tuple]::Create([tuple]::Create('id', $packageInfo.Name), [tuple]::Create('version', $packageInfo.Version))) > $null
}
}
-
- 'Microsoft.PowerShell.MarkdownRender' {
- $deps.Add([tuple]::Create([tuple]::Create('id', 'System.Management.Automation'), [tuple]::Create('version', $PackageVersion))) > $null
- foreach($packageInfo in (Get-ProjectPackageInformation -ProjectName $fileBaseName))
- {
- $deps.Add([tuple]::Create([tuple]::Create('id', $packageInfo.Name), [tuple]::Create('version', $packageInfo.Version))) > $null
- }
- }
}
New-NuSpec -PackageId $fileBaseName -PackageVersion $PackageVersion -Dependency $deps -FilePath (Join-Path $filePackageFolder.FullName "$fileBaseName.nuspec")
@@ -2321,7 +2311,6 @@ function CleanupGeneratedSourceCode
'[Microsoft.PowerShell.Commands.AddMemberCommand'
'[System.Management.Automation.ArgumentCompleterAttribute(typeof(Microsoft.PowerShell.Commands.Utility.JoinItemCompleter))]'
'[System.Management.Automation.ArgumentCompleterAttribute(typeof(System.Management.Automation.PropertyNameCompleter))]'
- '[System.Management.Automation.OutputTypeAttribute(typeof(Microsoft.PowerShell.MarkdownRender'
'[Microsoft.PowerShell.Commands.ArgumentToTypeNameTransformationAttribute]'
'[System.Management.Automation.Internal.ArchitectureSensitiveAttribute]'
'[Microsoft.PowerShell.Commands.SelectStringCommand.FileinfoToStringAttribute]'
diff --git a/tools/releaseBuild/azureDevOps/templates/windows-packaging.yml b/tools/releaseBuild/azureDevOps/templates/windows-packaging.yml
index a89a397f34..b9d577e989 100644
--- a/tools/releaseBuild/azureDevOps/templates/windows-packaging.yml
+++ b/tools/releaseBuild/azureDevOps/templates/windows-packaging.yml
@@ -124,13 +124,18 @@ jobs:
"$($fullSymbolsFolder)\System.Management.Automation.dll" = ""
}
+ $itemsToExclude = @{
+ # This package is retrieved from https://www.github.com/powershell/MarkdownRender
+ "$($fullSymbolsFolder)\Microsoft.PowerShell.MarkdownRender.dll"
+ }
+
if ("$env:Architecture" -notlike 'fxdependent*')
{
$itemsToCopy += @{"$($fullSymbolsFolder)\pwsh.exe" = ""}
}
Write-Verbose -verbose "recusively copying $($itemsToCopyWithRecurse | out-string) to $filesToSignDirectory"
- Copy-Item -Path $itemsToCopyWithRecurse -Destination $filesToSignDirectory -Recurse -verbose
+ Copy-Item -Path $itemsToCopyWithRecurse -Destination $filesToSignDirectory -Recurse -verbose -exclude $itemsToExclude
foreach($pattern in $itemsToCopy.Keys) {
$destinationFolder = Join-Path $filesToSignDirectory -ChildPath $itemsToCopy.$pattern
diff --git a/tools/releaseBuild/signing.xml b/tools/releaseBuild/signing.xml
index 017dc425e0..11f63fe69c 100644
--- a/tools/releaseBuild/signing.xml
+++ b/tools/releaseBuild/signing.xml
@@ -8,7 +8,6 @@
-