diff --git a/.changeset/long-peas-repeat.md b/.changeset/long-peas-repeat.md new file mode 100644 index 0000000000..1ea65056b4 --- /dev/null +++ b/.changeset/long-peas-repeat.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-techdocs-node': patch +--- + +Add support for mapping custom tags in the techdocs yaml parser that validates the mkdocs.yaml file diff --git a/plugins/techdocs-node/src/stages/generate/__fixtures__/mkdocs_with_extensions.yml b/plugins/techdocs-node/src/stages/generate/__fixtures__/mkdocs_with_extensions.yml index d6c6858722..d1209d0c21 100644 --- a/plugins/techdocs-node/src/stages/generate/__fixtures__/mkdocs_with_extensions.yml +++ b/plugins/techdocs-node/src/stages/generate/__fixtures__/mkdocs_with_extensions.yml @@ -4,4 +4,9 @@ site_description: Test site description markdown_extensions: - pymdownx.emoji: emoji_index: !!python/name:materialx.emoji.twemoji - emoji_generator: !!python/name:materialx.emoji.to_svg + emoji_generator: !!python/object.apply:materialx.emoji.to_svg + - pymdownx.tabbed: + alternate_style: true + slugify: !!python/object/apply:pymdownx.slugs.slugify + kwds: + case: lower diff --git a/plugins/techdocs-node/src/stages/generate/helpers.test.ts b/plugins/techdocs-node/src/stages/generate/helpers.test.ts index 755cd9d1a6..af61dae936 100644 --- a/plugins/techdocs-node/src/stages/generate/helpers.test.ts +++ b/plugins/techdocs-node/src/stages/generate/helpers.test.ts @@ -247,6 +247,10 @@ describe('helpers', () => { expect(updatedMkdocsYml.toString()).toContain( "emoji_index: !!python/name:materialx.emoji.twemoji ''", ); + expect(updatedMkdocsYml.toString()).toContain( + 'slugify: !!python/object/apply:pymdownx.slugs.slugify', + ); + expect(updatedMkdocsYml.toString()).toContain('case: lower'); }); it('should not override existing repo_url in mkdocs.yml', async () => { diff --git a/plugins/techdocs-node/src/stages/generate/helpers.ts b/plugins/techdocs-node/src/stages/generate/helpers.ts index d62b6dcccd..0cba56cfa5 100644 --- a/plugins/techdocs-node/src/stages/generate/helpers.ts +++ b/plugins/techdocs-node/src/stages/generate/helpers.ts @@ -141,6 +141,14 @@ export const MKDOCS_SCHEMA = DEFAULT_SCHEMA.extend([ instanceOf: UnknownTag, construct: (data: string, type?: string) => new UnknownTag(data, type), }), + new Type('tag:', { + kind: 'mapping', + multi: true, + representName: o => (o as UnknownTag).type, + represent: o => (o as UnknownTag).data ?? '', + instanceOf: UnknownTag, + construct: (data: string, type?: string) => new UnknownTag(data, type), + }), new Type('', { kind: 'sequence', multi: true,