content-entry-type.ts — astro Source File
Architecture documentation for content-entry-type.ts, a typescript file in the astro codebase. 4 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR deec1f28_4d3d_27c1_da09_7a6a276ef96d["content-entry-type.ts"] 520c567a_b741_f105_70ac_c637eacc7f83["../content/utils.js"] deec1f28_4d3d_27c1_da09_7a6a276ef96d --> 520c567a_b741_f105_70ac_c637eacc7f83 7f07e12d_4af0_1918_f31b_31410b415993["../types/public/content.js"] deec1f28_4d3d_27c1_da09_7a6a276ef96d --> 7f07e12d_4af0_1918_f31b_31410b415993 d9a92db9_c95e_9165_13ac_24b3d859d946["node:url"] deec1f28_4d3d_27c1_da09_7a6a276ef96d --> d9a92db9_c95e_9165_13ac_24b3d859d946 82f345a2_2234_43f1_c3c4_eea191acdca8["markdown-remark"] deec1f28_4d3d_27c1_da09_7a6a276ef96d --> 82f345a2_2234_43f1_c3c4_eea191acdca8 style deec1f28_4d3d_27c1_da09_7a6a276ef96d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { fileURLToPath, pathToFileURL } from 'node:url';
import { createMarkdownProcessor } from '@astrojs/markdown-remark';
import { safeParseFrontmatter } from '../content/utils.js';
import type { ContentEntryType } from '../types/public/content.js';
export const markdownContentEntryType: ContentEntryType = {
extensions: ['.md'],
async getEntryInfo({ contents, fileUrl }: { contents: string; fileUrl: URL }) {
const parsed = safeParseFrontmatter(contents, fileURLToPath(fileUrl));
return {
data: parsed.frontmatter,
body: parsed.content.trim(),
slug: parsed.frontmatter.slug,
rawData: parsed.rawFrontmatter,
};
},
// We need to handle propagation for Markdown because they support layouts which will bring in styles.
handlePropagation: true,
async getRenderFunction(config) {
const processor = await createMarkdownProcessor({
image: config.image,
...config.markdown,
});
return async function renderToString(entry) {
// Process markdown even if it's empty as remark/rehype plugins may add content or frontmatter dynamically
const result = await processor.render(entry.body ?? '', {
frontmatter: entry.data,
fileURL: entry.filePath ? pathToFileURL(entry.filePath) : undefined,
});
return {
html: result.code,
metadata: {
...result.metadata,
imagePaths: result.metadata.localImagePaths.concat(result.metadata.remoteImagePaths),
},
};
};
},
};
Domain
Subdomains
Dependencies
- ../content/utils.js
- ../types/public/content.js
- markdown-remark
- node:url
Source
Frequently Asked Questions
What does content-entry-type.ts do?
content-entry-type.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RenderingEngine subdomain.
What functions are defined in content-entry-type.ts?
content-entry-type.ts defines 2 function(s): markdownContentEntryType.getEntryInfo, markdownContentEntryType.getRenderFunction.
What does content-entry-type.ts depend on?
content-entry-type.ts imports 4 module(s): ../content/utils.js, ../types/public/content.js, markdown-remark, node:url.
Where is content-entry-type.ts in the architecture?
content-entry-type.ts is located at packages/astro/src/vite-plugin-markdown/content-entry-type.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/vite-plugin-markdown).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free