-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Try adding article html content to rss.
- Loading branch information
Adam Drewery
committed
Jun 29, 2023
1 parent
bb4b116
commit b307c0a
Showing
4 changed files
with
52 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"rss": "^1.2.2" | ||
"rss": "^1.2.2", | ||
"axios": "^0.21.1" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
@layout EmptyLayout | ||
@inject HttpClient Http | ||
@inject IJSRuntime JsRuntime | ||
@page "/raw/{Id}" | ||
@using Markdig | ||
|
||
@code { | ||
[Parameter] | ||
public string? Id { get; set; } | ||
|
||
string? _content; | ||
|
||
protected override async Task OnParametersSetAsync() | ||
{ | ||
var markdown = await Http.GetStringAsync($"https://raw.githubusercontent.com/adam-drewery/blog/main/content/{Id}.md") | ||
?? throw new InvalidOperationException("Failed to get blog content"); | ||
|
||
_content = Markdown.ToHtml(markdown); | ||
} | ||
|
||
protected override async Task OnAfterRenderAsync(bool firstRender) | ||
{ | ||
await JsRuntime.InvokeVoidAsync("fitImages"); | ||
await JsRuntime.InvokeVoidAsync("highlightCode"); | ||
} | ||
} | ||
|
||
<div class="page-wrapper"> | ||
<section class="pb-5"> | ||
<div class="container"> | ||
<div class="row pt-5"> | ||
<div class="col-xl-8"> | ||
@if (_content != null) { @((MarkupString)_content) } | ||
</div> | ||
<div id="comments" class="col-xl-8"></div> | ||
</div> | ||
</div> | ||
</section> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
@inherits LayoutComponentBase | ||
@Body |