本文整理匯總了TypeScript中gulp-markdown.default函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript default函數的具體用法?TypeScript default怎麽用?TypeScript default使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了default函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: src
task('markdown-docs', () => {
// Extend the renderer for custom heading anchor rendering
markdown.marked.Renderer.prototype.heading = (text: string, level: number): string => {
if (level === 3 || level === 4) {
const escapedText = text.toLowerCase().replace(/[^\w]+/g, '-');
return `
<h${level} id="${escapedText}" class="docs-header-link">
<div header-link="${escapedText}"></div>
${text}
</h${level}>
`;
} else {
return `<h${level}>${text}</h${level}>`;
}
};
return src(['src/lib/**/*.md', 'src/cdk/**/*.md', 'guides/*.md'])
.pipe(markdown({
// Add syntax highlight using highlight.js
highlight: (code: string, language: string): string => {
if (language) {
// highlight.js expects "typescript" written out, while Github supports "ts".
let lang = language.toLowerCase() === 'ts' ? 'typescript' : language;
return hljs.highlight(lang, code).value;
}
return code;
}
}))
.pipe(transform(transformMarkdownFiles))
.pipe(dom(createTagNameAliaser('docs-markdown')))
.pipe(dest('dist/docs/markdown'));
});
示例2:
gulp.task('docs', () => {
return gulp.src(['src/lib/**/*.md'])
.pipe(markdown())
.pipe(transform((content: string) =>
content.toString().replace(EXAMPLE_PATTERN, (match: string, name: string) =>
`<div material-docs-example="${name}"></div>`)))
.pipe(gulp.dest('dist/docs'));
});
示例3: src
task('markdown-docs-cdk', () => {
return src(['src/cdk/**/!(README).md'])
.pipe(rename({prefix: 'cdk-'}))
.pipe(markdown(markdownOptions))
.pipe(transform(transformMarkdownFiles))
.pipe(dom(createTagNameAliaser('docs-markdown')))
.pipe(dest('dist/docs/markdown'));
});
示例4:
gulp.task('markdown-docs', () => {
return gulp.src(['src/lib/**/*.md', 'guides/*.md'])
.pipe(markdown({
// Add syntax highlight using highlight.js
highlight: (code: string, language: string) => {
if (language) {
// highlight.js expects "typescript" written out, while Github supports "ts".
let lang = language.toLowerCase() === 'ts' ? 'typescript' : language;
return hljs.highlight(lang, code).value;
}
return code;
}
}))
.pipe(transform(transformMarkdownFiles))
.pipe(gulp.dest('dist/docs/markdown'));
});
示例5:
gulp.task('docs', () => {
return gulp.src(['src/lib/**/*.md', 'guides/*.md'])
.pipe(markdown({
// Add syntax highlight using highlight.js
highlight: (code: string, language: string) => {
if (language) {
// highlight.js expects "typescript" written out, while Github supports "ts".
let lang = language.toLowerCase() === 'ts' ? 'typescript' : language;
return hljs.highlight(lang, code).value;
}
return code;
}
}))
.pipe(transform((content: string) =>
content.toString().replace(EXAMPLE_PATTERN, (match: string, name: string) =>
`<div material-docs-example="${name}"></div>`)))
.pipe(gulp.dest('dist/docs'));
});