plugin integration round 2
This commit is contained in:
		
							parent
							
								
									a757521313
								
							
						
					
					
						commit
						ad6ce0d73f
					
				
					 29 changed files with 3863 additions and 100 deletions
				
			
		
							
								
								
									
										26
									
								
								quartz/plugins/emitters/contentPage.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								quartz/plugins/emitters/contentPage.ts
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,26 @@
 | 
			
		|||
import { resolveToRoot } from "../../path"
 | 
			
		||||
import { EmitCallback, QuartzEmitterPlugin } from "../types"
 | 
			
		||||
import { ProcessedContent } from "../vfile"
 | 
			
		||||
 | 
			
		||||
export class ContentPage extends QuartzEmitterPlugin {
 | 
			
		||||
  name = "ContentPage"
 | 
			
		||||
  async emit(content: ProcessedContent[], emit: EmitCallback): Promise<string[]> {
 | 
			
		||||
    const fps: string[] = []
 | 
			
		||||
    for (const [tree, file] of content) {
 | 
			
		||||
      const pathToRoot = resolveToRoot(file.data.slug!)
 | 
			
		||||
 | 
			
		||||
      const fp = file.data.slug + ".html"
 | 
			
		||||
      await emit({
 | 
			
		||||
        title: file.data.frontmatter?.title ?? "Untitled",
 | 
			
		||||
        description: file.data.description ?? "",
 | 
			
		||||
        slug: file.data.slug!,
 | 
			
		||||
        ext: ".html",
 | 
			
		||||
      })
 | 
			
		||||
 | 
			
		||||
      // TODO: process aliases
 | 
			
		||||
 | 
			
		||||
      fps.push(fp)
 | 
			
		||||
    }
 | 
			
		||||
    return fps
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										1
									
								
								quartz/plugins/emitters/index.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								quartz/plugins/emitters/index.ts
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
export { ContentPage } from './contentPage'
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue