mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-15 10:07:33 +02:00
chore: release Docusaurus v3.1 (#9705)
Co-authored-by: Joshua Chen <sidachen2003@gmail.com> Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com> Co-authored-by: Sébastien Lorber <slorber@users.noreply.github.com> Co-authored-by: Ivan Mar (sOkam!) <7308253+heysokam@users.noreply.github.com> Co-authored-by: c0h1b4 <dwidman@gmail.com> Co-authored-by: Janessa Garrow <janessa.garrow@gmail.com> Co-authored-by: ozaki <29860391+OzakIOne@users.noreply.github.com> Co-authored-by: axmmisaka <6500159+axmmisaka@users.noreply.github.com> Co-authored-by: Tatsunori Uchino <tats.u@live.jp> Co-authored-by: Simen Bekkhus <sbekkhus91@gmail.com> fix(i18n): complete translations for theme-common.json Brazilian Portuguese (pt-BR) (#9477) fix(content-blog): add baseUrl for author.image_url (#9581) fix(type-aliases): add `title` prop for imported inline SVG React components (#9612) fix(utils): Markdown link replacement with <> but no spaces (#9617) fix(live-codeblock): stabilize react-live transformCode callback, fix editor/preview desync (#9631) fix(cli): output help when no conventional config + no subcommand (#9648) fix CI job (#9604) fix Lint Autofix workflow (#9632) fix(pwa-plugin): upgrade workbox (#9668) fix(create-docusaurus): fix init template code blocks, and little improvements (#9696) fix(theme): allow empty code blocks and live playgrounds (#9704)
This commit is contained in:
parent
a2e05d2118
commit
7b1b89041f
140 changed files with 3187 additions and 1707 deletions
|
@ -13,18 +13,31 @@ const codeBlockTitleRegex = /title=(?<quote>["'])(?<title>.*?)\1/;
|
|||
const metastringLinesRangeRegex = /\{(?<range>[\d,-]+)\}/;
|
||||
|
||||
// Supported types of highlight comments
|
||||
const commentPatterns = {
|
||||
const popularCommentPatterns = {
|
||||
js: {start: '\\/\\/', end: ''},
|
||||
jsBlock: {start: '\\/\\*', end: '\\*\\/'},
|
||||
jsx: {start: '\\{\\s*\\/\\*', end: '\\*\\/\\s*\\}'},
|
||||
bash: {start: '#', end: ''},
|
||||
html: {start: '<!--', end: '-->'},
|
||||
} as const;
|
||||
|
||||
const commentPatterns = {
|
||||
...popularCommentPatterns, // shallow copy is sufficient
|
||||
// minor comment styles
|
||||
lua: {start: '--', end: ''},
|
||||
wasm: {start: '\\;\\;', end: ''},
|
||||
tex: {start: '%', end: ''},
|
||||
};
|
||||
vb: {start: "['‘’]", end: ''},
|
||||
rem: {start: '[Rr][Ee][Mm]\\b', end: ''},
|
||||
f90: {start: '!', end: ''}, // Free format only
|
||||
ml: {start: '\\(\\*', end: '\\*\\)'},
|
||||
cobol: {start: '\\*>', end: ''}, // Free format only
|
||||
} as const;
|
||||
|
||||
type CommentType = keyof typeof commentPatterns;
|
||||
const popularCommentTypes = Object.keys(
|
||||
popularCommentPatterns,
|
||||
) as CommentType[];
|
||||
|
||||
export type MagicCommentConfig = {
|
||||
className: string;
|
||||
|
@ -99,15 +112,34 @@ function getAllMagicCommentDirectiveStyles(
|
|||
case 'wasm':
|
||||
return getCommentPattern(['wasm'], magicCommentDirectives);
|
||||
|
||||
case 'vb':
|
||||
case 'vbnet':
|
||||
case 'vba':
|
||||
case 'visual-basic':
|
||||
return getCommentPattern(['vb', 'rem'], magicCommentDirectives);
|
||||
|
||||
case 'batch':
|
||||
return getCommentPattern(['rem'], magicCommentDirectives);
|
||||
|
||||
case 'basic': // https://github.com/PrismJS/prism/blob/master/components/prism-basic.js#L3
|
||||
return getCommentPattern(['rem', 'f90'], magicCommentDirectives);
|
||||
|
||||
case 'fsharp':
|
||||
return getCommentPattern(['js', 'ml'], magicCommentDirectives);
|
||||
|
||||
case 'ocaml':
|
||||
case 'sml':
|
||||
return getCommentPattern(['ml'], magicCommentDirectives);
|
||||
|
||||
case 'fortran':
|
||||
return getCommentPattern(['f90'], magicCommentDirectives);
|
||||
|
||||
case 'cobol':
|
||||
return getCommentPattern(['cobol'], magicCommentDirectives);
|
||||
|
||||
default:
|
||||
// All comment types except lua, wasm and matlab
|
||||
return getCommentPattern(
|
||||
Object.keys(commentPatterns).filter(
|
||||
(pattern) =>
|
||||
!['lua', 'wasm', 'tex', 'latex', 'matlab'].includes(pattern),
|
||||
) as CommentType[],
|
||||
magicCommentDirectives,
|
||||
);
|
||||
// All popular comment types
|
||||
return getCommentPattern(popularCommentTypes, magicCommentDirectives);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue