File tree 1 file changed +14
-1
lines changed
1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -111,6 +111,19 @@ let first_posts: PostMetadata[] = posts_metadata.slice(0, 5); //not truly the re
111
111
112
112
const site_info : SiteInfo = _site_info ;
113
113
114
+ function html_entity_convert ( html : string ) {
115
+ const entity_table = {
116
+ " " : " " ,
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
+
114
127
let posts_rss : RSSPost [ ] = first_posts . map ( ( post ) => {
115
128
//get url
116
129
let url : string = `${ site_info . url } /posts/${ post . slug } ` ;
@@ -125,7 +138,7 @@ let posts_rss: RSSPost[] = first_posts.map((post) => {
125
138
//get html
126
139
let post_md_path : string = path . join ( __dirname , `/posts/${ post . filename } .md` ) ;
127
140
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 ) ) ;
129
142
//turn into rsspost
130
143
return {
131
144
...post ,
You can’t perform that action at this time.
0 commit comments