/ src / modules / cmdpal / ext / SamplePagesExtension / Pages / SampleMarkdownPage.cs
SampleMarkdownPage.cs
  1  // Copyright (c) Microsoft Corporation
  2  // The Microsoft Corporation licenses this file to you under the MIT license.
  3  // See the LICENSE file in the project root for more information.
  4  
  5  using Microsoft.CommandPalette.Extensions;
  6  using Microsoft.CommandPalette.Extensions.Toolkit;
  7  
  8  namespace SamplePagesExtension;
  9  
 10  internal sealed partial class SampleMarkdownPage : ContentPage
 11  {
 12      public static readonly string SampleMarkdownText = @"
 13  # Markdown Guide
 14  
 15  Markdown is a lightweight markup language with plain text formatting syntax. It's often used to format readme files, for writing messages in online forums, and to create rich text using a simple, plain text editor.
 16  
 17  ## Basic Markdown Formatting
 18  
 19  ### Headings
 20  
 21      # This is an <h1> tag
 22      ## This is an <h2> tag
 23      ### This is an <h3> tag
 24      #### This is an <h4> tag
 25      ##### This is an <h5> tag
 26      ###### This is an <h6> tag
 27  
 28  ### Emphasis
 29  
 30      *This text will be italic*
 31      _This will also be italic_
 32  
 33      **This text will be bold**
 34      __This will also be bold__
 35  
 36      _You **can** combine them_
 37  
 38  Result:
 39  
 40  *This text will be italic*
 41  
 42  _This will also be italic_
 43  
 44  **This text will be bold**
 45  
 46  __This will also be bold__
 47  
 48  _You **can** combine them_
 49  
 50  ### Lists
 51  
 52  **Unordered:**
 53  
 54      * Milk
 55      * Bread
 56          * Whole grain
 57      * Butter
 58  
 59  Result:
 60  
 61  * Milk
 62  * Bread
 63      * Whole grain
 64  * Butter
 65  
 66  **Ordered:**
 67  
 68      1. Tidy the kitchen
 69      2. Prepare ingredients
 70      3. Cook delicious things
 71  
 72  Result:
 73  
 74  1. Tidy the kitchen
 75  2. Prepare ingredients
 76  3. Cook delicious things
 77  
 78  ### Images
 79  
 80      ![Alt Text](url)
 81  
 82  Result:
 83  
 84  ![painting](https://raw.githubusercontent.com/microsoft/PowerToys/refs/heads/main/doc/images/overview/Original/AdvancedPaste.png)
 85  
 86  ### Links
 87  
 88      [example](http://example.com)
 89  
 90  Result:
 91  
 92  [example](http://example.com)
 93  
 94  ### Blockquotes
 95  
 96      As Albert Einstein said:
 97  
 98      > If we knew what it was we were doing,
 99      > it would not be called research, would it?
100  
101  Result:
102  
103  As Albert Einstein said:
104  
105  > If we knew what it was we were doing,
106  > it would not be called research, would it?
107  
108  ### Horizontal Rules
109  
110  ```markdown
111      ---
112  ```
113  
114  Result:
115  
116  ---
117  
118  ### Code Snippets
119  
120      Indenting by 4 spaces will turn an entire paragraph into a code-block.
121  
122  Result:
123  
124      .my-link {
125          text-decoration: underline;
126      }
127  
128  ### Reference Lists & Titles
129  
130      **The quick brown [fox][1], jumped over the lazy [dog][2].**
131  
132      [1]: https://en.wikipedia.org/wiki/Fox ""Wikipedia: Fox""
133      [2]: https://en.wikipedia.org/wiki/Dog ""Wikipedia: Dog""
134  
135  Result:
136  
137  **The quick brown [fox][1], jumped over the lazy [dog][2].**
138  
139  [1]: https://en.wikipedia.org/wiki/Fox ""Wikipedia: Fox""
140  [2]: https://en.wikipedia.org/wiki/Dog ""Wikipedia: Dog""
141  
142  ### Escaping
143  
144      \*literally\*
145  
146  Result:
147  
148  \*literally\*
149  
150  ## Tables
151  
152  ### Pipe table
153  
154  [Markdig - Pipe Table specs](https://github.com/xoofx/markdig/blob/master/src/Markdig.Tests/Specs/PipeTableSpecs.md)
155  
156  | Right | Left | Default | Center |
157  |------:|:-----|---------|:------:|
158  |   12  |  12  |    12   |    12  |
159  |  123  |  123 |   123   |   123  |
160  |    1  |    1 |     1   |     1  |
161  
162  ### HTML table
163  
164  <table>
165  <thead>
166  <tr>
167  <th style=""text-align: left;"">a</th>
168  <th style=""text-align: center;"">b</th>
169  <th style=""text-align: right;"">c</th>
170  </tr>
171  </thead>
172  <tbody>
173  <tr>
174  <td style=""text-align: left;"">0</td>
175  <td style=""text-align: center;"">1</td>
176  <td style=""text-align: right;"">2</td>
177  </tr>
178  <tr>
179  <td style=""text-align: left;"">3</td>
180  <td style=""text-align: center;"">4</td>
181  <td style=""text-align: right;"">5</td>
182  </tr>
183  </tbody>
184  </table>
185  
186  
187  ## Advanced Markdown
188  
189  [Markdig - emphasis extensions](https://github.com/xoofx/markdig/blob/master/src/Markdig.Tests/Specs/EmphasisExtraSpecs.md)
190  
191  Note: Some syntax which is not standard to native Markdown. They're extensions of the language.
192  
193  ### Strike-throughs
194  
195      ~~deleted words~~
196  
197  Result:
198  
199  ~~deleted words~~
200  
201  
202  ";
203  
204      public SampleMarkdownPage()
205      {
206          Icon = new IconInfo(string.Empty);
207          Name = "Sample Markdown Page";
208      }
209  
210      public override IContent[] GetContent() => [new MarkdownContent(SampleMarkdownText)];
211  }