mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-01 02:12:36 +02:00
refactor: capitalize comments (#7188)
* refactor: capitalize comments * revert...
This commit is contained in:
parent
200009008b
commit
fa1ce230ea
99 changed files with 241 additions and 350 deletions
|
@ -79,7 +79,7 @@ export default function plugin(options: PluginOptions = {}): Transformer {
|
|||
visit(root, 'heading', (child: Heading, index, parent) => {
|
||||
const value = toString(child);
|
||||
|
||||
// depth:1 headings are titles and not included in the TOC
|
||||
// depth: 1 headings are titles and not included in the TOC
|
||||
if (parent !== root || !value || child.depth < 2) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ async function getImageAbsolutePath(
|
|||
await ensureImageFileExist(imageFilePath, filePath);
|
||||
return imageFilePath;
|
||||
} else if (path.isAbsolute(imagePath)) {
|
||||
// absolute paths are expected to exist in the static folder
|
||||
// Absolute paths are expected to exist in the static folder.
|
||||
const possiblePaths = staticDirs.map((dir) => path.join(dir, imagePath));
|
||||
const imageFilePath = await findAsyncSequential(
|
||||
possiblePaths,
|
||||
|
@ -120,7 +120,7 @@ async function getImageAbsolutePath(
|
|||
}
|
||||
return imageFilePath;
|
||||
}
|
||||
// relative paths are resolved against the source file's folder
|
||||
// Relative paths are resolved against the source file's folder.
|
||||
const imageFilePath = path.join(
|
||||
path.dirname(filePath),
|
||||
decodeURIComponent(imagePath),
|
||||
|
|
|
@ -34,7 +34,9 @@ type Context = PluginOptions & {
|
|||
filePath: string;
|
||||
};
|
||||
|
||||
// transform the link node to a jsx link with a require() call
|
||||
/**
|
||||
* Transforms the link node to a JSX `<a>` element with a `require()` call.
|
||||
*/
|
||||
function toAssetRequireNode(node: Link, assetPath: string, filePath: string) {
|
||||
const jsxNode = node as Literal & Partial<Link>;
|
||||
let relativeAssetPath = posixPath(
|
||||
|
@ -106,7 +108,7 @@ async function getAssetAbsolutePath(
|
|||
|
||||
async function processLinkNode(node: Link, context: Context) {
|
||||
if (!node.url) {
|
||||
// try to improve error feedback
|
||||
// Try to improve error feedback
|
||||
// see https://github.com/facebook/docusaurus/issues/3309#issuecomment-690371675
|
||||
const title = node.title || (node.children[0] as Literal)?.value || '?';
|
||||
const line = node?.position?.start?.line || '?';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue