SuperAPI AI Directory

conversation-json-to-md-cn

Office & productivity

View repository

Updated 10-16 04:40

About this skill

Conversation JSON to Markdown (Chinese)

Overview

Convert the user-provided chat export JSON into multiple clearly structured Markdown files, unified into a question-and-answer structure. The process splits files by conversation, keeps only user and assistant question-and-answer content, preserves the Markdown in the answers, and performs one round of secondary cleanup of naming and heading structure after export.

When to Use

Use this skill when the user has the following needs:

  • Split one conversation export JSON into multiple .md
  • One conversation corresponds to one Markdown file
  • Keep only user and assistant question-and-answer content
  • Questions are used as headings, and answers are unified as 回答
  • Perform one round of secondary formatting of naming and headings after export

Do Not Use

This skill should not be used in the following scenarios:

  • Ordinary text rewriting unrelated to JSON conversation exports
  • Tasks processing non-conversation data structures
  • The user wants a semantic summary rather than a structured export

Usage Instructions

  1. You must read the input file path explicitly provided by the user, and do not assume a default file name.
  2. Automatically identify the JSON structure and extract conversations.
  3. Export each conversation as one Markdown file.
  4. Keep only user/assistant question-and-answer content.
  5. The question-and-answer format is fixed as:
    • ## <问题文本>
    • ### 回答
  6. Preserve the Markdown in the answer body, and demote all headings inside answers by 1 level.
  7. After export is complete, perform one independent secondary formatting check and correction pass.

Supported Input Structures

The script can recognize the following common formats:

  • DeepSeek/ChatGPT-style mapping/root/children/fragments
  • Qwen-style data[].chat.messages[] + content_list(prefer phase=answer)
  • Claude web export list[{ name, chat_messages: [...] }]
  • Generic message array messages/history/conversations/dialog/turns
  • Paired question-and-answer fields question-answer、prompt-response、input-output

If the structure cannot be recognized, stop and ask the user to provide a sample fragment, then extend the parsing rules.

Run the Script

python3 scripts/convert_conversations.py \
  --input /path/to/<用户提供>.json \
  --output-dir /path/to/conversations_md \
  --clean

Output Format (Fixed)

# <会话标题>

## <用户问题1>
### 回答
<助手回答 Markdown>

## <用户问题2>
### 回答
<助手回答 Markdown>

Secondary Formatting Process (Independent Step)

After export, perform secondary formatting on the output directory:

  1. File name normalization:
  • Keep the “conversation title only” naming
  • Clean illegal characters
  • Fill in duplicates with (2)、 (3) numbers
  1. Heading structure normalization:
  • Level-one headings keep only the conversation title:# <会话标题>
  • Each question must be a level-two heading
  • Each answer must be ### 回答
  1. Answer body normalization:
  • Preserve Markdown
  • Demote internal headings by 1 level to avoid conflicts with the outer structure
  1. Result re-check:
  • When files that do not comply with the rules are found, correct them one by one before delivery

Verification Checklist

  • The number of exported files matches the number of recognized conversations
  • File names have no random suffix
  • Files do not contain ## REQUEST / ## RESPONSE
  • Answer blocks are unified as ### 回答
  • Markdown preview rendering is normal