From 9a25e97c4041fae916547d80e30e61ec027b892d Mon Sep 17 00:00:00 2001 From: Lauryn Menard Date: Fri, 1 Aug 2025 17:04:51 +0200 Subject: [PATCH] help-beta: Adjust icon class names in the conversion process. Use the icon's name, in camelcase, with the suffix "Icon" for icon class names in the new help center documentation. E.g., zulip-icon-external-link becomes ExternalLinkIcon and fa fa-plus becomes PlusIcon. --- tools/convert-help-center-docs-to-mdx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tools/convert-help-center-docs-to-mdx b/tools/convert-help-center-docs-to-mdx index a199da4be7..aff508a385 100755 --- a/tools/convert-help-center-docs-to-mdx +++ b/tools/convert-help-center-docs-to-mdx @@ -154,11 +154,10 @@ def insert_string_at_line(text: str, destination_str: str, n: int) -> str: def replace_icon_with_unplugin_component( match: re.Match[str], icon_package_name: str, - icon_component_prefix: str, import_statement_set: set[str], ) -> str: icon_name = match.group(1) - component_name = icon_component_prefix + to_pascal(icon_name).replace("-", "") + component_name = to_pascal(icon_name).replace("-", "") + "Icon" import_statement = f'import {component_name} from "~icons/{icon_package_name}/{icon_name}"' import_statement_set.add(import_statement) return f"<{component_name} />" @@ -174,7 +173,7 @@ def replace_icons(markdown_string: str, import_statement_set: set[str]) -> str: ) def replace_font_awesome_icon_with_unplugin_component(match: re.Match[str]) -> str: - return replace_icon_with_unplugin_component(match, "fa", "Fa", import_statement_set) + return replace_icon_with_unplugin_component(match, "fa", import_statement_set) result = re.sub( font_awesome_pattern, replace_font_awesome_icon_with_unplugin_component, markdown_string @@ -185,9 +184,7 @@ def replace_icons(markdown_string: str, import_statement_set: set[str]) -> str: ) def replace_zulip_icon_with_unplugin_component(match: re.Match[str]) -> str: - return replace_icon_with_unplugin_component( - match, "zulip-icon", "ZulipIcons", import_statement_set - ) + return replace_icon_with_unplugin_component(match, "zulip-icon", import_statement_set) result = re.sub(zulip_icon_pattern, replace_zulip_icon_with_unplugin_component, result)