fix: escape encoding for titles in rss
This commit is contained in:
		@@ -1,6 +1,7 @@
 | 
			
		||||
import { Root as HTMLRoot } from "hast"
 | 
			
		||||
import { toString } from "hast-util-to-string"
 | 
			
		||||
import { QuartzTransformerPlugin } from "../types"
 | 
			
		||||
import { escapeHTML } from "../../util/escape"
 | 
			
		||||
 | 
			
		||||
export interface Options {
 | 
			
		||||
  descriptionLength: number
 | 
			
		||||
@@ -10,15 +11,6 @@ const defaultOptions: Options = {
 | 
			
		||||
  descriptionLength: 150,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const escapeHTML = (unsafe: string) => {
 | 
			
		||||
  return unsafe
 | 
			
		||||
    .replaceAll("&", "&")
 | 
			
		||||
    .replaceAll("<", "<")
 | 
			
		||||
    .replaceAll(">", ">")
 | 
			
		||||
    .replaceAll('"', """)
 | 
			
		||||
    .replaceAll("'", "'")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export const Description: QuartzTransformerPlugin<Partial<Options> | undefined> = (userOpts) => {
 | 
			
		||||
  const opts = { ...defaultOptions, ...userOpts }
 | 
			
		||||
  return {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user