mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-02-23 19:49:43 +01:00
Officially deprecate FormPage and MarkdownPage (#459)
`ContentPage` is the more generic form of this. I'm deprecating this here in 0.0.8, and in 0.0.9 I'm gonna outright remove it.
This commit is contained in:
@@ -152,18 +152,15 @@ public partial class MastodonExtensionCommandsProvider : CommandProvider
|
||||
}
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1402:File may only contain a single type", Justification = "This is sample code")]
|
||||
public partial class MastodonPostForm : Form
|
||||
public partial class MastodonPostForm : FormContent
|
||||
{
|
||||
private readonly MastodonStatus post;
|
||||
|
||||
public MastodonPostForm(MastodonStatus post)
|
||||
{
|
||||
this.post = post;
|
||||
}
|
||||
|
||||
public override string DataJson()
|
||||
{
|
||||
return $$"""
|
||||
DataJson = $$"""
|
||||
{
|
||||
"author_display_name": {{JsonSerializer.Serialize(post.Account.DisplayName)}},
|
||||
"author_username": {{JsonSerializer.Serialize(post.Account.Username)}},
|
||||
@@ -173,12 +170,7 @@ public partial class MastodonPostForm : Form
|
||||
"post_url": "{{post.Url}}"
|
||||
}
|
||||
""";
|
||||
}
|
||||
|
||||
public override ICommandResult SubmitForm(string payload) => CommandResult.Dismiss();
|
||||
|
||||
public override string TemplateJson()
|
||||
{
|
||||
var img_block = string.Empty;
|
||||
if (post.MediaAttachments.Count > 0)
|
||||
{
|
||||
@@ -186,7 +178,7 @@ public partial class MastodonPostForm : Form
|
||||
.Select(media => $$""",{"type": "Image","url":"{{media.Url}}","size": "stretch"}""").ToArray());
|
||||
}
|
||||
|
||||
return $$"""
|
||||
TemplateJson = $$"""
|
||||
{
|
||||
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
|
||||
"type": "AdaptiveCard",
|
||||
@@ -252,10 +244,12 @@ public partial class MastodonPostForm : Form
|
||||
}
|
||||
""";
|
||||
}
|
||||
|
||||
public override ICommandResult SubmitForm(string inputs) => CommandResult.Dismiss();
|
||||
}
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1402:File may only contain a single type", Justification = "This is sample code")]
|
||||
public partial class MastodonPostPage : FormPage
|
||||
public partial class MastodonPostPage : ContentPage
|
||||
{
|
||||
private readonly MastodonStatus post;
|
||||
|
||||
@@ -265,7 +259,7 @@ public partial class MastodonPostPage : FormPage
|
||||
this.post = post;
|
||||
}
|
||||
|
||||
public override IForm[] Forms()
|
||||
public override IContent[] GetContent()
|
||||
{
|
||||
var postsAsync = GetRepliesAsync();
|
||||
postsAsync.ConfigureAwait(false);
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Text.Json.Nodes;
|
||||
using Microsoft.CommandPalette.Extensions.Toolkit;
|
||||
|
||||
namespace SamplePagesExtension;
|
||||
|
||||
internal sealed partial class SampleForm : Form
|
||||
{
|
||||
public SampleForm()
|
||||
{
|
||||
}
|
||||
|
||||
public override string TemplateJson()
|
||||
{
|
||||
var json = $$"""
|
||||
{
|
||||
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
|
||||
"type": "AdaptiveCard",
|
||||
"version": "1.5",
|
||||
"body": [
|
||||
{
|
||||
"type": "TextBlock",
|
||||
"text": "🚧 This is a sample form 🚧",
|
||||
"weight": "bolder",
|
||||
"size": "extraLarge",
|
||||
"spacing": "none",
|
||||
"wrap": true,
|
||||
"style": "heading"
|
||||
},
|
||||
{
|
||||
"type": "Input.Text",
|
||||
"style": "text",
|
||||
"id": "hotkey",
|
||||
"label": "Input.Text Example",
|
||||
"value": "example value",
|
||||
"isRequired": false
|
||||
}
|
||||
],
|
||||
"actions": [
|
||||
{
|
||||
"type": "Action.Submit",
|
||||
"title": "Save",
|
||||
"data": {
|
||||
"name": "name",
|
||||
"url": "url"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
""";
|
||||
return json;
|
||||
}
|
||||
|
||||
public override string StateJson() => "{}";
|
||||
|
||||
public override CommandResult SubmitForm(string payload)
|
||||
{
|
||||
var formInput = JsonNode.Parse(payload)?.AsObject();
|
||||
if (formInput == null)
|
||||
{
|
||||
return CommandResult.GoHome();
|
||||
}
|
||||
|
||||
// Application.Current.GetService<ILocalSettingsService>().SaveSettingAsync("GlobalHotkey", formInput["hotkey"]?.ToString() ?? string.Empty);
|
||||
return CommandResult.GoHome();
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Microsoft.CommandPalette.Extensions;
|
||||
using Microsoft.CommandPalette.Extensions.Toolkit;
|
||||
|
||||
namespace SamplePagesExtension;
|
||||
|
||||
internal sealed partial class SampleFormPage : FormPage
|
||||
{
|
||||
private readonly SampleForm sampleForm = new();
|
||||
|
||||
public override IForm[] Forms() => [sampleForm];
|
||||
|
||||
public SampleFormPage()
|
||||
{
|
||||
Name = "Sample Form";
|
||||
Icon = new IconInfo(string.Empty);
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,12 @@
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Microsoft.CommandPalette.Extensions;
|
||||
using Microsoft.CommandPalette.Extensions.Toolkit;
|
||||
|
||||
namespace SamplePagesExtension;
|
||||
|
||||
internal sealed partial class SampleMarkdownPage : MarkdownPage
|
||||
internal sealed partial class SampleMarkdownPage : ContentPage
|
||||
{
|
||||
public static readonly string SampleMarkdownText = @"
|
||||
# Markdown Guide
|
||||
@@ -167,5 +168,5 @@ Result:
|
||||
Name = "Sample Markdown Page";
|
||||
}
|
||||
|
||||
public override string[] Bodies() => [SampleMarkdownText];
|
||||
public override IContent[] GetContent() => [new MarkdownContent(SampleMarkdownText)];
|
||||
}
|
||||
|
||||
@@ -50,8 +50,6 @@ public partial class SamplesListPage : ListPage
|
||||
Subtitle = "Demo of using nested trees of content to create a comment thread-like experience",
|
||||
Icon = new IconInfo("\uE90A"), // Comment
|
||||
},
|
||||
|
||||
// DEPRECATED: Markdown pages
|
||||
new ListItem(new SampleMarkdownPage())
|
||||
{
|
||||
Title = "Markdown Page Sample Command",
|
||||
@@ -68,13 +66,6 @@ public partial class SamplesListPage : ListPage
|
||||
Subtitle = "A page with markdown and details",
|
||||
},
|
||||
|
||||
// DEPRECATED: Form pages
|
||||
new ListItem(new SampleFormPage())
|
||||
{
|
||||
Title = "Form Page Sample Command",
|
||||
Subtitle = "Define inputs to retrieve input from the user",
|
||||
},
|
||||
|
||||
// Settings helpers
|
||||
new ListItem(new SampleSettingsPage())
|
||||
{
|
||||
|
||||
@@ -2,19 +2,17 @@
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text.Json.Nodes;
|
||||
using Microsoft.CommandPalette.Extensions;
|
||||
using Microsoft.CommandPalette.Extensions.Toolkit;
|
||||
|
||||
namespace SpongebotExtension;
|
||||
|
||||
internal sealed partial class SpongeSettingsForm : Form
|
||||
internal sealed partial class SpongeSettingsForm : FormContent
|
||||
{
|
||||
public override string TemplateJson()
|
||||
public SpongeSettingsForm()
|
||||
{
|
||||
var json = $$"""
|
||||
TemplateJson = $$"""
|
||||
{
|
||||
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
|
||||
"type": "AdaptiveCard",
|
||||
@@ -49,7 +47,6 @@ internal sealed partial class SpongeSettingsForm : Form
|
||||
]
|
||||
}
|
||||
""";
|
||||
return json;
|
||||
}
|
||||
|
||||
public override CommandResult SubmitForm(string payload)
|
||||
|
||||
@@ -12,7 +12,7 @@ using Microsoft.CommandPalette.Extensions.Toolkit;
|
||||
|
||||
namespace SpongebotExtension;
|
||||
|
||||
public partial class SpongebotPage : MarkdownPage, IFallbackHandler
|
||||
public partial class SpongebotPage : ContentPage, IFallbackHandler
|
||||
{
|
||||
public CopyTextCommand CopyCommand { get; set; } = new(string.Empty);
|
||||
|
||||
@@ -46,11 +46,11 @@ public partial class SpongebotPage : MarkdownPage, IFallbackHandler
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public override string[] Bodies()
|
||||
public override IContent[] GetContent()
|
||||
{
|
||||
var t = GenerateMeme(this.Name);
|
||||
t.ConfigureAwait(false);
|
||||
return [t.Result];
|
||||
return [new MarkdownContent(t.Result)];
|
||||
}
|
||||
|
||||
private static async Task<string> GenerateMeme(string text)
|
||||
|
||||
@@ -7,11 +7,11 @@ using Microsoft.CommandPalette.Extensions.Toolkit;
|
||||
|
||||
namespace SpongebotExtension;
|
||||
|
||||
internal sealed partial class SpongebotSettingsPage : FormPage
|
||||
internal sealed partial class SpongebotSettingsPage : ContentPage
|
||||
{
|
||||
private readonly SpongeSettingsForm settingsForm = new();
|
||||
|
||||
public override IForm[] Forms() => [settingsForm];
|
||||
public override IContent[] GetContent() => [settingsForm];
|
||||
|
||||
public SpongebotSettingsPage()
|
||||
{
|
||||
|
||||
@@ -2,24 +2,18 @@
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Nodes;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.CommandPalette.Extensions.Toolkit;
|
||||
using YouTubeExtension.Helper;
|
||||
|
||||
namespace YouTubeExtension.Pages;
|
||||
|
||||
internal sealed partial class YouTubeAPIForm : Form
|
||||
internal sealed partial class YouTubeAPIForm : FormContent
|
||||
{
|
||||
public override string TemplateJson()
|
||||
public YouTubeAPIForm()
|
||||
{
|
||||
var json = $$"""
|
||||
TemplateJson = $$"""
|
||||
{
|
||||
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
|
||||
"type": "AdaptiveCard",
|
||||
@@ -45,7 +39,6 @@ internal sealed partial class YouTubeAPIForm : Form
|
||||
]
|
||||
}
|
||||
""";
|
||||
return json;
|
||||
}
|
||||
|
||||
public override CommandResult SubmitForm(string payload)
|
||||
|
||||
@@ -2,21 +2,16 @@
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.CommandPalette.Extensions;
|
||||
using Microsoft.CommandPalette.Extensions.Toolkit;
|
||||
|
||||
namespace YouTubeExtension.Pages;
|
||||
|
||||
internal sealed partial class YouTubeAPIPage : FormPage
|
||||
internal sealed partial class YouTubeAPIPage : ContentPage
|
||||
{
|
||||
private readonly YouTubeAPIForm apiForm = new();
|
||||
|
||||
public override IForm[] Forms() => [apiForm];
|
||||
public override IContent[] GetContent() => [apiForm];
|
||||
|
||||
public YouTubeAPIPage()
|
||||
{
|
||||
|
||||
@@ -7,12 +7,13 @@ using System.IO;
|
||||
using System.Net.Http;
|
||||
using System.Text.Json.Nodes;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.CommandPalette.Extensions;
|
||||
using Microsoft.CommandPalette.Extensions.Toolkit;
|
||||
using YouTubeExtension.Helper;
|
||||
|
||||
namespace YouTubeExtension.Pages;
|
||||
|
||||
internal sealed partial class YouTubeChannelInfoMarkdownPage : MarkdownPage
|
||||
internal sealed partial class YouTubeChannelInfoMarkdownPage : ContentPage
|
||||
{
|
||||
private readonly YouTubeChannel _channel;
|
||||
private string _markdown = string.Empty;
|
||||
@@ -24,7 +25,7 @@ internal sealed partial class YouTubeChannelInfoMarkdownPage : MarkdownPage
|
||||
_channel = channel;
|
||||
}
|
||||
|
||||
public override string[] Bodies()
|
||||
public override IContent[] GetContent()
|
||||
{
|
||||
var state = File.ReadAllText(YouTubeHelper.StateJsonPath());
|
||||
var jsonState = JsonNode.Parse(state);
|
||||
@@ -60,7 +61,7 @@ _Last updated: {DateTime.Now:MMMM dd, yyyy}_
|
||||
_Data sourced via YouTube API_
|
||||
";
|
||||
|
||||
return new string[] { _markdown };
|
||||
return [new MarkdownContent(_markdown)];
|
||||
}
|
||||
|
||||
private async Task<YouTubeChannel> FillInChannelDetailsAsync(YouTubeChannel channel, string apiKey)
|
||||
|
||||
@@ -13,7 +13,7 @@ using YouTubeExtension.Helper;
|
||||
|
||||
namespace YouTubeExtension.Pages;
|
||||
|
||||
internal sealed partial class YouTubeVideoInfoMarkdownPage : MarkdownPage
|
||||
internal sealed partial class YouTubeVideoInfoMarkdownPage : ContentPage
|
||||
{
|
||||
private readonly YouTubeVideo _video;
|
||||
private string _markdown = string.Empty;
|
||||
@@ -25,7 +25,7 @@ internal sealed partial class YouTubeVideoInfoMarkdownPage : MarkdownPage
|
||||
_video = video;
|
||||
}
|
||||
|
||||
public override string[] Bodies()
|
||||
public override IContent[] GetContent()
|
||||
{
|
||||
var state = File.ReadAllText(YouTubeHelper.StateJsonPath());
|
||||
var jsonState = JsonNode.Parse(state);
|
||||
@@ -74,7 +74,7 @@ _Last updated: {DateTime.Now:MMMM dd, yyyy}_
|
||||
_Data sourced via YouTube API_
|
||||
";
|
||||
|
||||
return new string[] { _markdown };
|
||||
return [new MarkdownContent(_markdown)];
|
||||
}
|
||||
|
||||
private async Task<YouTubeVideo> FillInVideoDetailsAsync(YouTubeVideo video, string apiKey)
|
||||
|
||||
@@ -1162,6 +1162,8 @@ on nested pages will all work exactly as expected. -->
|
||||
|
||||
#### Markdown Pages
|
||||
|
||||
Deprecated. Don't use me. Use ContentPage instead.
|
||||
|
||||
```csharp
|
||||
interface IMarkdownPage requires IPage {
|
||||
String[] Bodies(); // TODO! should this be an IBody, so we can make it observable?
|
||||
@@ -1172,6 +1174,7 @@ interface IMarkdownPage requires IPage {
|
||||
|
||||
#### Form Pages
|
||||
|
||||
Deprecated. Don't use me. Use ContentPage instead.
|
||||
|
||||
```csharp
|
||||
|
||||
|
||||
@@ -2,8 +2,11 @@
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Windows.Foundation.Metadata;
|
||||
|
||||
namespace Microsoft.CommandPalette.Extensions.Toolkit;
|
||||
|
||||
[Deprecated("Use FormContent instead", DeprecationType.Deprecate, 8)]
|
||||
public abstract partial class Form : IForm
|
||||
{
|
||||
public virtual string Data { get; set; } = string.Empty;
|
||||
|
||||
@@ -2,8 +2,11 @@
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Windows.Foundation.Metadata;
|
||||
|
||||
namespace Microsoft.CommandPalette.Extensions.Toolkit;
|
||||
|
||||
[Deprecated("Use ContentPage instead", DeprecationType.Deprecate, 8)]
|
||||
public abstract partial class FormPage : Page, IFormPage
|
||||
{
|
||||
public abstract IForm[] Forms();
|
||||
|
||||
@@ -17,4 +17,13 @@ public partial class MarkdownContent : BaseObservable, IMarkdownContent
|
||||
}
|
||||
|
||||
= string.Empty;
|
||||
|
||||
public MarkdownContent()
|
||||
{
|
||||
}
|
||||
|
||||
public MarkdownContent(string body)
|
||||
{
|
||||
Body = body;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,11 @@
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Windows.Foundation.Metadata;
|
||||
|
||||
namespace Microsoft.CommandPalette.Extensions.Toolkit;
|
||||
|
||||
[Deprecated("Use MarkdownContent & ContentPage instead", DeprecationType.Deprecate, 8)]
|
||||
public partial class MarkdownPage : Page, IMarkdownPage
|
||||
{
|
||||
private IDetails? _details;
|
||||
|
||||
@@ -2,31 +2,98 @@
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using Microsoft.CommandPalette.Extensions;
|
||||
using Microsoft.CommandPalette.Extensions.Toolkit;
|
||||
|
||||
namespace SamplePagesExtension;
|
||||
|
||||
internal sealed partial class SampleMarkdownDetails : MarkdownPage
|
||||
internal sealed partial class SampleMarkdownDetails : ContentPage
|
||||
{
|
||||
public SampleMarkdownDetails()
|
||||
{
|
||||
Icon = new IconInfo(string.Empty);
|
||||
Name = "Markdown with Details";
|
||||
|
||||
Details = new Details()
|
||||
{
|
||||
Body = "... with _even more Markdown_ by it.",
|
||||
Body = "... with _even more Markdown_ by it.\nEach of the sections below is some sample metadata",
|
||||
Metadata = [
|
||||
new DetailsElement()
|
||||
{
|
||||
Key = "Plain text",
|
||||
Data = new DetailsLink() { Text = "Set just the text to get text metadata" },
|
||||
},
|
||||
new DetailsElement()
|
||||
{
|
||||
Key = "Links",
|
||||
Data = new DetailsLink() { Text = "Or metadata can be links", Link = new("https://github.com/microsoft/PowerToys") },
|
||||
},
|
||||
new DetailsElement()
|
||||
{
|
||||
Key = "CmdPal will display the URL if no text is given",
|
||||
Data = new DetailsLink() { Link = new("https://github.com/microsoft/PowerToys") },
|
||||
},
|
||||
new DetailsElement()
|
||||
{
|
||||
Key = "Above a separator",
|
||||
Data = new DetailsLink() { Text = "Below me is a separator" },
|
||||
},
|
||||
new DetailsElement()
|
||||
{
|
||||
Key = "A separator",
|
||||
Data = new DetailsSeparator(),
|
||||
},
|
||||
new DetailsElement()
|
||||
{
|
||||
Key = "Below a separator",
|
||||
Data = new DetailsLink() { Text = "Above me is a separator" },
|
||||
},
|
||||
new DetailsElement()
|
||||
{
|
||||
Key = "Add Tags too",
|
||||
Data = new DetailsTags()
|
||||
{
|
||||
Tags = [
|
||||
new Tag("simple text"),
|
||||
new Tag("Colored text") { Foreground = ColorHelpers.FromRgb(255, 0, 0) },
|
||||
new Tag("Colored backgrounds") { Background = ColorHelpers.FromRgb(0, 0, 255) },
|
||||
new Tag("Colored everything") { Foreground = ColorHelpers.FromRgb(255, 255, 0), Background = ColorHelpers.FromRgb(0, 0, 255) },
|
||||
new Tag("Icons too") { Icon = new IconInfo("\uE735"), Foreground = ColorHelpers.FromRgb(255, 255, 0) },
|
||||
new Tag() { Icon = new IconInfo("https://i.imgur.com/t9qgDTM.png") },
|
||||
new Tag("this") { Foreground = RandomColor(), Background = RandomColor() },
|
||||
new Tag("baby") { Foreground = RandomColor(), Background = RandomColor() },
|
||||
new Tag("can") { Foreground = RandomColor(), Background = RandomColor() },
|
||||
new Tag("fit") { Foreground = RandomColor(), Background = RandomColor() },
|
||||
new Tag("so") { Foreground = RandomColor(), Background = RandomColor() },
|
||||
new Tag("many") { Foreground = RandomColor(), Background = RandomColor() },
|
||||
new Tag("tags") { Foreground = RandomColor(), Background = RandomColor() },
|
||||
new Tag("in") { Foreground = RandomColor(), Background = RandomColor() },
|
||||
new Tag("it") { Foreground = RandomColor(), Background = RandomColor() },
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
public override string[] Bodies() => [
|
||||
public override IContent[] GetContent() => [new MarkdownContent(
|
||||
"""
|
||||
# This page also has details
|
||||
|
||||
So you can have markdown...
|
||||
""",
|
||||
"""
|
||||
"""),
|
||||
new MarkdownContent("""
|
||||
But what this is really useful for is the tags and other things you can put into
|
||||
Details. Which I'd do. **IF I HAD ANY**.
|
||||
"""
|
||||
""")
|
||||
];
|
||||
|
||||
private static OptionalColor RandomColor()
|
||||
{
|
||||
var r = new Random();
|
||||
var b = new byte[3];
|
||||
r.NextBytes(b);
|
||||
return ColorHelpers.FromRgb(b[0], b[1], b[2]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Microsoft.CommandPalette.Extensions;
|
||||
using Microsoft.CommandPalette.Extensions.Toolkit;
|
||||
|
||||
namespace SamplePagesExtension;
|
||||
|
||||
internal sealed partial class SampleMarkdownManyBodies : MarkdownPage
|
||||
internal sealed partial class SampleMarkdownManyBodies : ContentPage
|
||||
{
|
||||
public SampleMarkdownManyBodies()
|
||||
{
|
||||
@@ -14,20 +15,24 @@ internal sealed partial class SampleMarkdownManyBodies : MarkdownPage
|
||||
Name = "Markdown with many bodies";
|
||||
}
|
||||
|
||||
public override string[] Bodies() => [
|
||||
public override IContent[] GetContent() => [
|
||||
new MarkdownContent(
|
||||
"""
|
||||
# This page has many bodies
|
||||
|
||||
On it you'll find multiple blocks of markdown content
|
||||
""",
|
||||
"""),
|
||||
new MarkdownContent(
|
||||
"""
|
||||
## Here's another block
|
||||
|
||||
_Maybe_ you could use this pattern for implementing a post with comments page.
|
||||
""",
|
||||
"""),
|
||||
new MarkdownContent(
|
||||
"""
|
||||
> or don't, it's your app, do whatever you want
|
||||
""",
|
||||
"""),
|
||||
new MarkdownContent(
|
||||
"""
|
||||
You can even use it to write cryptic poems:
|
||||
> It's a peculiar thing, the way that I feel
|
||||
@@ -45,6 +50,6 @@ You can even use it to write cryptic poems:
|
||||
> This part of the story, I never wanted to tell
|
||||
> Good bye old friend, my pal, farewell.
|
||||
|
||||
"""
|
||||
"""),
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user