MCPcopy Create free account
hub / github.com/api-platform/website / extractTitleFromMarkdown

Function extractTitleFromMarkdown

pwa/prebuild.js:173–187  ·  view source on GitHub ↗
(content: string)

Source from the content-addressed store, hash-verified

171}
172
173function extractTitleFromMarkdown(content: string) {
174 const lines = content.split("\n");
175 for (let index = 0; index < lines.length; index++) {
176 const line = lines[index];
177 const result = line.match(/#\s(.*)/);
178
179 if (null === result || result.length === 0) {
180 continue;
181 }
182
183 return result[1];
184 }
185
186 return null;
187}
188
189// export async function getMarkdownStreamTitle(version: string, slug: string[]) {
190// const stream = createReadStream(

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected