mirror of
https://github.com/alrayyes/wiki.git
synced 2025-05-01 22:48:14 +00:00
fix: escape encoding for titles in rss
This commit is contained in:
parent
ef1ead31dc
commit
828aa71fe3
3 changed files with 15 additions and 14 deletions
quartz/plugins/transformers
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue