Skip to content

Commit 500cbd6

Browse files
committed
feed fix
1 parent ccb848a commit 500cbd6

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

index.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,19 @@ let first_posts: PostMetadata[] = posts_metadata.slice(0, 5); //not truly the re
111111

112112
const site_info: SiteInfo = _site_info;
113113

114+
function html_entity_convert(html: string) {
115+
const entity_table = {
116+
"&nbsp": "&#160",
117+
"<": "<",
118+
">": ">",
119+
};
120+
for (let i=0; i < Object.keys(entity_table).length; i++) {
121+
let entity_name = Object.keys(entity_table)[i];
122+
html = html.replaceAll(entity_name, entity_table[entity_name]);
123+
}
124+
return html;
125+
}
126+
114127
let posts_rss: RSSPost[] = first_posts.map((post) => {
115128
//get url
116129
let url: string = `${site_info.url}/posts/${post.slug}`;
@@ -125,7 +138,7 @@ let posts_rss: RSSPost[] = first_posts.map((post) => {
125138
//get html
126139
let post_md_path: string = path.join(__dirname, `/posts/${post.filename}.md`);
127140
let md: string = readFileSync(post_md_path, "utf-8").replaceAll("\r", "");
128-
let html: string = parse_md_to_html(md);
141+
let html: string = html_entity_convert(parse_md_to_html(md));
129142
//turn into rsspost
130143
return {
131144
...post,

0 commit comments

Comments
 (0)