@@ -24,15 +24,15 @@ let highlightPlugin: {
2424 highlighter : Highlighter
2525}
2626let highlightPluginPromise : Promise < typeof highlightPlugin >
27- async function getHighlighPluginInstance ( options : HighlighterOptions ) {
27+ async function getHighlightPluginInstance ( options : HighlighterOptions ) {
2828 if ( ! highlightPlugin ) {
29- highlightPluginPromise = highlightPluginPromise || _getHighlighPlugin ( options )
29+ highlightPluginPromise = highlightPluginPromise || _getHighlightPlugin ( options )
3030 await highlightPluginPromise
3131 }
3232
3333 return highlightPlugin
3434}
35- async function _getHighlighPlugin ( options : HighlighterOptions ) {
35+ async function _getHighlightPlugin ( options : HighlighterOptions ) {
3636 const key = hash ( JSON . stringify ( options || { } ) )
3737 if ( ! highlightPlugin || highlightPlugin . key !== key ) {
3838 const langs = Array . from ( new Set ( [ 'bash' , 'html' , 'mdc' , 'vue' , 'yml' , 'scss' , 'ts' , 'ts' , 'typescript' , ...( options . langs || [ ] ) ] ) )
@@ -76,7 +76,7 @@ export async function parseContent(key: string, content: string, collection: Res
7676 rehypePlugins : {
7777 highlight : mdcOptions . highlight === false
7878 ? undefined
79- : await getHighlighPluginInstance ( mdcOptions . highlight || { } ) ,
79+ : await getHighlightPluginInstance ( mdcOptions . highlight || { } ) ,
8080 ...mdcOptions ?. rehypePlugins ,
8181 ...contentOptions ?. rehypePlugins ,
8282 } ,
@@ -105,8 +105,9 @@ export async function parseContent(key: string, content: string, collection: Res
105105 result . meta = meta
106106
107107 // Storing `content` into `rawbody` field
108- // This allow users to define `rowbody` field in collection schema and access to raw content
109- result . rawbody = content
108+ if ( collectionKeys . includes ( 'rawbody' ) ) {
109+ result . rawbody = result . rawbody ?? content
110+ }
110111
111112 return result
112113}
0 commit comments