Skip to content

Commit

Permalink
Avoid deprecation for mkdocs emojis plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
nvuillam committed Dec 30, 2024
1 parent 4163dca commit d28d283
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/common/utils/docUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,10 @@ export function readMkDocsFile(mkdocsYmlFile: string): any {
const mkdocsYml: any = yaml.load(
fs
.readFileSync(mkdocsYmlFile, 'utf-8')
.replace('!!python/name:materialx.emoji.twemoji', "'!!python/name:materialx.emoji.twemoji'")
.replace('!!python/name:materialx.emoji.to_svg', "'!!python/name:materialx.emoji.to_svg'")
.replace('!!python/name:materialx.emoji.twemoji', "!!python/name:material.extensions.emoji.twemoji")
.replace('!!python/name:materialx.emoji.to_svg', "!!python/name:material.extensions.emoji.to_svg")
.replace('!!python/name:material.extensions.emoji.twemoji', "'!!python/name:material.extensions.emoji.twemoji'")
.replace('!!python/name:material.extensions.emoji.to_svg', "'!!python/name:material.extensions.emoji.to_svg'")
.replace('!!python/name:pymdownx.superfences.fence_code_format', "'!!python/name:pymdownx.superfences.fence_code_format'")
);
if (!mkdocsYml.nav) {
Expand All @@ -96,8 +98,10 @@ export function readMkDocsFile(mkdocsYmlFile: string): any {
export async function writeMkDocsFile(mkdocsYmlFile: string, mkdocsYml: any) {
const mkdocsYmlStr = yaml
.dump(mkdocsYml)
.replace("'!!python/name:materialx.emoji.twemoji'", '!!python/name:materialx.emoji.twemoji')
.replace("'!!python/name:materialx.emoji.to_svg'", '!!python/name:materialx.emoji.to_svg')
.replace("!!python/name:materialx.emoji.twemoji", '!!python/name:material.extensions.emoji.twemoji')
.replace("!!python/name:materialx.emoji.to_svg", '!!python/name:material.extensions.emoji.to_svg')
.replace("'!!python/name:material.extensions.emoji.twemoji'", '!!python/name:material.extensions.emoji.twemoji')
.replace("'!!python/name:material.extensions.emoji.to_svg'", '!!python/name:material.extensions.emoji.to_svg')
.replace("'!!python/name:pymdownx.superfences.fence_code_format'", '!!python/name:pymdownx.superfences.fence_code_format');
await fs.writeFile(mkdocsYmlFile, mkdocsYmlStr);
uxLog(this, c.cyan(`Updated mkdocs-material config file at ${c.green(mkdocsYmlFile)}`));
Expand Down

0 comments on commit d28d283

Please sign in to comment.