Skip to content

Commit

Permalink
fix(feed2): compatable with beta.20
Browse files Browse the repository at this point in the history
  • Loading branch information
Mister-Hope committed Jun 30, 2021
1 parent d9e97e2 commit 062cd10
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
9 changes: 2 additions & 7 deletions packages/feed2/src/node/page.ts
Expand Up @@ -4,12 +4,7 @@ import {
isAbsoluteUrl,
isUrl,
} from "@mr-hope/vuepress-shared";
import {
getImageMineType,
resolveHTML,
removeTemplate,
resolveUrl,
} from "./utils";
import { getImageMineType, resolveHTML, resolveUrl } from "./utils";

import type { BaseThemeConfig } from "@mr-hope/vuepress-shared";
import type { App, Page, PageFrontmatter } from "@vuepress/core";
Expand Down Expand Up @@ -125,7 +120,7 @@ export class FeedPage {
get content(): string {
if (this.feedOption.content) return this.feedOption.content;

return resolveHTML(removeTemplate(this.page.componentFileContent));
return resolveHTML(this.page.contentRendered);
}

get image(): string | undefined {
Expand Down
3 changes: 0 additions & 3 deletions packages/feed2/src/node/utils.ts
Expand Up @@ -29,9 +29,6 @@ export const resolveHTML = (html: string): string =>
// remove tex
.replace(/<math[\s\S]*?\/math>/gu, "<i>Content not supported</i>");

export const removeTemplate = (content: string): string =>
content.replace(/<template>.*<\/template>/, "$1");

export const resolveUrl = (hostname: string, base = "", path = ""): string =>
`${hostname}${
// make sure base starts and ends with '/'
Expand Down

0 comments on commit 062cd10

Please sign in to comment.