mermaid2conf
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMarkdown To Confluence
Markdown 转 Confluence
Pre-Requisites
前提条件
-
Confirmis installed
uvshellcommand -v "uv" || echo "NOT INSTALLED"Ifis not installed prompt for approval to installuvuvshellcurl -LsSf https://astral.sh/uv/install.sh | sh -
Confirmis installed
mermaid-clishellnpm list -g @mermaid-js/mermaid-cli || echo "NOT INSTALLED"Ifis not installed prompt for approval to installmermaid-cliuvshellnpm install -g @mermaid-js/mermaid-cli -
Confirm confluence configuration existsshell
[ -f ~/.config/markdown-to-confluence/confluence_config.json ] && echo "Exists" || echo "Does not exist"If Confluence Configuration file does not exist, direct user to visit Configure Confluence Credentials and terminate
-
确认已安装
uvshellcommand -v "uv" || echo "NOT INSTALLED"如果未安装,请确认是否同意安装uvuvshellcurl -LsSf https://astral.sh/uv/install.sh | sh -
确认已安装
mermaid-clishellnpm list -g @mermaid-js/mermaid-cli || echo "NOT INSTALLED"如果未安装,请确认是否同意安装mermaid-climermaid-clishellnpm install -g @mermaid-js/mermaid-cli -
确认Confluence配置文件已存在shell
[ -f ~/.config/markdown-to-confluence/confluence_config.json ] && echo "Exists" || echo "Does not exist"如果Confluence配置文件不存在,请引导用户访问配置Confluence凭据并终止操作
Inputs
输入信息
- Ask the user for the path to the markdown file. Wait for their response before proceeding. This value will be referred to by $SOURCE_MD
- Read the $SOURCE_MD markdown file and check for YAML frontmatter with:
- ($CONFLUENCE_URL)
confluence_url
- If is not present in the YAML frontmatter, prompt the user for a Confluence url ($CONFLUENCE_URL)
confluence_url- Extract the $PAGE_ID from $CONFLUENCE_URL - it is the numeric segment after in the path.
/pages/ - Extract the $SECTION_NAME from $CONFLUENCE_URL - it is the string after at the end of the URL
#- If not found, use an empty string instead ""
- Extract the $PAGE_ID from $CONFLUENCE_URL - it is the numeric segment after
- 询问用户Markdown文件的路径,等待用户回复后再继续。该路径将用$SOURCE_MD表示
- 读取$SOURCE_MD对应的Markdown文件,检查是否包含带有以下内容的YAML前置信息:
- ($CONFLUENCE_URL)
confluence_url
- 如果YAML前置信息中没有,请提示用户输入Confluence地址($CONFLUENCE_URL)
confluence_url- 从$CONFLUENCE_URL中提取$PAGE_ID - 即路径中之后的数字部分
/pages/ - 从$CONFLUENCE_URL中提取$SECTION_NAME - 即URL末尾之后的字符串
#- 如果未找到,则使用空字符串""
- 从$CONFLUENCE_URL中提取$PAGE_ID - 即路径中
Execution
执行步骤
Substitute all variable references with their exact values
- Process the mermaid diagram
shell
uvx mermaid2conf process "$SOURCE_MD" - Publish the document to confluence
shell
uvx mermaid2conf publish "$PAGE_ID" "$SECTION_NAME"
将所有变量替换为对应的确切值
- 处理Mermaid图表
shell
uvx mermaid2conf process "$SOURCE_MD" - 将文档发布到Confluence
shell
uvx mermaid2conf publish "$PAGE_ID" "$SECTION_NAME"