mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-20 12:37:01 +02:00
misc(v2): clean up comments in code (#2294)
This commit is contained in:
parent
d7f3dff6e6
commit
996b115199
45 changed files with 234 additions and 155 deletions
|
@ -41,7 +41,7 @@ const DEFAULT_OPTIONS: PluginOptions = {
|
|||
blogTagsPostsComponent: '@theme/BlogTagsPostsPage',
|
||||
remarkPlugins: [],
|
||||
rehypePlugins: [],
|
||||
truncateMarker: /<!--\s*(truncate)\s*-->/, // Regex
|
||||
truncateMarker: /<!--\s*(truncate)\s*-->/, // Regex.
|
||||
};
|
||||
|
||||
function assertFeedTypes(val: any): asserts val is FeedType {
|
||||
|
@ -94,7 +94,7 @@ export default function pluginContentBlog(
|
|||
return null;
|
||||
}
|
||||
|
||||
// Colocate next and prev metadata
|
||||
// Colocate next and prev metadata.
|
||||
blogPosts.forEach((blogPost, index) => {
|
||||
const prevItem = index > 0 ? blogPosts[index - 1] : null;
|
||||
if (prevItem) {
|
||||
|
@ -103,6 +103,7 @@ export default function pluginContentBlog(
|
|||
permalink: prevItem.metadata.permalink,
|
||||
};
|
||||
}
|
||||
|
||||
const nextItem =
|
||||
index < blogPosts.length - 1 ? blogPosts[index + 1] : null;
|
||||
if (nextItem) {
|
||||
|
@ -168,7 +169,8 @@ export default function pluginContentBlog(
|
|||
const permalink = normalizeUrl([tagsPath, normalizedTag]);
|
||||
if (!blogTags[normalizedTag]) {
|
||||
blogTags[normalizedTag] = {
|
||||
name: tag.toLowerCase(), // Will only use the name of the first occurrence of the tag.
|
||||
// Will only use the name of the first occurrence of the tag.
|
||||
name: tag.toLowerCase(),
|
||||
items: [],
|
||||
permalink,
|
||||
};
|
||||
|
@ -232,7 +234,8 @@ export default function pluginContentBlog(
|
|||
blogPosts.map(async blogPost => {
|
||||
const {id, metadata} = blogPost;
|
||||
await createData(
|
||||
// Note that this created data path must be in sync with metadataPath provided to mdx-loader
|
||||
// Note that this created data path must be in sync with
|
||||
// metadataPath provided to mdx-loader.
|
||||
`${docuHash(metadata.source)}.json`,
|
||||
JSON.stringify(metadata, null, 2),
|
||||
);
|
||||
|
@ -374,7 +377,8 @@ export default function pluginContentBlog(
|
|||
options: {
|
||||
remarkPlugins,
|
||||
rehypePlugins,
|
||||
// Note that metadataPath must be the same/ in-sync as the path from createData for each MDX
|
||||
// Note that metadataPath must be the same/in-sync as
|
||||
// the path from createData for each MDX.
|
||||
metadataPath: (mdxPath: string) => {
|
||||
const aliasedSource = aliasedSitePath(mdxPath, siteDir);
|
||||
return path.join(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue