mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-29 17:07:08 +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
|
@ -156,7 +156,6 @@ describe('localizePath', () => {
|
|||
currentLocale: 'en',
|
||||
localeConfigs: {},
|
||||
},
|
||||
// options: {localizePath: true},
|
||||
}),
|
||||
).toBe('/baseUrl/');
|
||||
});
|
||||
|
@ -172,7 +171,6 @@ describe('localizePath', () => {
|
|||
currentLocale: 'en',
|
||||
localeConfigs: {},
|
||||
},
|
||||
// options: {localizePath: true},
|
||||
}),
|
||||
).toBe('/baseUrl/');
|
||||
});
|
||||
|
|
|
@ -38,7 +38,7 @@ describe('createExcerpt', () => {
|
|||
Nunc porttitor libero nec vulputate venenatis. Nam nec rhoncus mauris. Morbi tempus est et nibh maximus, tempus venenatis arcu lobortis.
|
||||
`),
|
||||
).toBe(
|
||||
// h1 title is skipped on purpose, because we don't want the page to have
|
||||
// H1 title is skipped on purpose, because we don't want the page to have
|
||||
// SEO metadata title === description
|
||||
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ex urna, molestie et sagittis ut, varius ac justo.',
|
||||
);
|
||||
|
@ -56,7 +56,7 @@ describe('createExcerpt', () => {
|
|||
Nunc porttitor libero nec vulputate venenatis. Nam nec rhoncus mauris. Morbi tempus est et nibh maximus, tempus venenatis arcu lobortis.
|
||||
`),
|
||||
).toBe(
|
||||
// h1 title is skipped on purpose, because we don't want the page to have
|
||||
// H1 title is skipped on purpose, because we don't want the page to have
|
||||
// SEO metadata title === description
|
||||
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ex urna, molestie et sagittis ut, varius ac justo.',
|
||||
);
|
||||
|
@ -377,7 +377,7 @@ Lorem Ipsum
|
|||
|
||||
`;
|
||||
|
||||
// remove the useless line breaks? Does not matter too much
|
||||
// Remove the useless line breaks? Does not matter too much
|
||||
expect(parseMarkdownContentTitle(markdown)).toEqual({
|
||||
content: markdown,
|
||||
contentTitle: 'Markdown Title',
|
||||
|
|
|
@ -112,7 +112,7 @@ export function getFileCommitDate(
|
|||
const result = shell.exec(
|
||||
`git log ${extraArgs} ${formatArg} -- "${path.basename(file)}"`,
|
||||
{
|
||||
// cwd is important, see: https://github.com/facebook/docusaurus/pull/5048
|
||||
// Setting cwd is important, see: https://github.com/facebook/docusaurus/pull/5048
|
||||
cwd: path.dirname(file),
|
||||
silent: true,
|
||||
},
|
||||
|
|
|
@ -61,7 +61,7 @@ export function getPluginI18nPath({
|
|||
return path.join(
|
||||
siteDir,
|
||||
I18N_DIR_NAME,
|
||||
// namespace first by locale: convenient to work in a single folder for a
|
||||
// Namespace first by locale: convenient to work in a single folder for a
|
||||
// translator
|
||||
locale,
|
||||
// Make it convenient to use for single-instance
|
||||
|
|
|
@ -21,8 +21,10 @@ const isWindows = () => process.platform === 'win32';
|
|||
export const isNameTooLong = (str: string): boolean =>
|
||||
// Not entirely correct: we can't assume FS from OS. But good enough?
|
||||
isMacOs() || isWindows()
|
||||
? str.length + SPACE_FOR_APPENDING > MAX_PATH_SEGMENT_CHARS // macOS (APFS) and Windows (NTFS) filename length limit (255 chars)
|
||||
: Buffer.from(str).length + SPACE_FOR_APPENDING > MAX_PATH_SEGMENT_BYTES; // Other (255 bytes)
|
||||
? // Windows (NTFS) and macOS (APFS) filename length limit (255 chars)
|
||||
str.length + SPACE_FOR_APPENDING > MAX_PATH_SEGMENT_CHARS
|
||||
: // Other (255 bytes)
|
||||
Buffer.from(str).length + SPACE_FOR_APPENDING > MAX_PATH_SEGMENT_BYTES;
|
||||
|
||||
export function shortName(str: string): string {
|
||||
if (isMacOs() || isWindows()) {
|
||||
|
|
|
@ -24,7 +24,7 @@ function normalizeFrontMatterTag(
|
|||
|
||||
// TODO maybe make ensure the permalink is valid url path?
|
||||
function normalizeTagPermalink(permalink: string): string {
|
||||
// note: we always apply tagsPath on purpose. For versioned docs, v1/doc.md
|
||||
// Note: we always apply tagsPath on purpose. For versioned docs, v1/doc.md
|
||||
// and v2/doc.md tags with custom permalinks don't lead to the same created
|
||||
// page. tagsPath is different for each doc version
|
||||
return normalizeUrl([tagsPath, permalink]);
|
||||
|
|
|
@ -158,7 +158,6 @@ export function isValidPathname(str: string): boolean {
|
|||
return false;
|
||||
}
|
||||
try {
|
||||
// weird, but is there a better way?
|
||||
const parsedPathname = new URL(str, 'https://domain.com').pathname;
|
||||
return parsedPathname === str || parsedPathname === encodeURI(str);
|
||||
} catch {
|
||||
|
|
|
@ -37,11 +37,10 @@ type FileLoaderUtils = {
|
|||
* Inspired by https://github.com/gatsbyjs/gatsby/blob/8e6e021014da310b9cc7d02e58c9b3efe938c665/packages/gatsby/src/utils/webpack-utils.ts#L447
|
||||
*/
|
||||
export function getFileLoaderUtils(): FileLoaderUtils {
|
||||
// files/images < urlLoaderLimit will be inlined as base64 strings directly in
|
||||
// Files/images < urlLoaderLimit will be inlined as base64 strings directly in
|
||||
// the html
|
||||
const urlLoaderLimit = WEBPACK_URL_LOADER_LIMIT;
|
||||
|
||||
// defines the path/pattern of the assets handled by webpack
|
||||
const fileLoaderFileName = (folder: AssetFolder) =>
|
||||
path.posix.join(
|
||||
OUTPUT_STATIC_ASSETS_DIR_NAME,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue