halo-sigs / plugin-text-diagram

为默认编辑器和文章渲染提供文本绘图支持。
GNU General Public License v3.0
5 stars 1 forks source link

mermaid display failed #13

Open acwwt opened 7 months ago

acwwt commented 7 months ago

预览的时候正常 image 但是发布以后的文章显示报错,所有东西都是默认的没有改过 image

xinkeng0 commented 7 months ago

有文章链接吗?

acwwt commented 7 months ago

有的,https://blog.lingkongstudy.com.cn/archives/1713941371238

xinkeng0 commented 7 months ago

看报错的话初步判断是存储的文本换行有点问题,flowchart LR subgraph Lagent tool LR和subgraph之间应有一个换行符号呢。

{
    "str": "Parse error on line 1:\nflowchart LR subgraph Lagent tool\n-------------^\nExpecting 'SEMI', 'NEWLINE', 'SPACE', 'EOF', 'AMP', 'ALPHA', 'COLON', 'START_LINK', 'LINK', 'DOWN', 'DEFAULT', 'NUM', 'COMMA', 'MINUS', 'BRKT', 'DOT', 'PUNCTUATION', 'UNICODE_TEXT', 'PLUS', 'EQUALS', 'MULT', 'UNDERSCORE', got 'subgraph'",
    "message": "Parse error on line 1:\nflowchart LR subgraph Lagent tool\n-------------^\nExpecting 'SEMI', 'NEWLINE', 'SPACE', 'EOF', 'AMP', 'ALPHA', 'COLON', 'START_LINK', 'LINK', 'DOWN', 'DEFAULT', 'NUM', 'COMMA', 'MINUS', 'BRKT', 'DOT', 'PUNCTUATION', 'UNICODE_TEXT', 'PLUS', 'EQUALS', 'MULT', 'UNDERSCORE', got 'subgraph'",
    "hash": "Error",
    "error": {
        "hash": {
            "text": "subgraph",
            "token": "subgraph",
            "line": 0,
            "loc": {
                "first_line": 1,
                "last_line": 1,
                "first_column": 12,
                "last_column": 13
            },
            "expected": [
                "'SEMI'",
                "'NEWLINE'",
                "'SPACE'",
                "'EOF'",
                "'AMP'",
                "'ALPHA'",
                "'COLON'",
                "'START_LINK'",
                "'LINK'",
                "'DOWN'",
                "'DEFAULT'",
                "'NUM'",
                "'COMMA'",
                "'MINUS'",
                "'BRKT'",
                "'DOT'",
                "'PUNCTUATION'",
                "'UNICODE_TEXT'",
                "'PLUS'",
                "'EQUALS'",
                "'MULT'",
                "'UNDERSCORE'"
            ]
        }
    }
}
acwwt commented 7 months ago

但是这里面是有换行符的,而且预览的时候并没有问题

flowchart LR
    subgraph Lagent
        tool[调用工具]
        subgraph AgentLego
            tool_support[工具功能支持]
        end
        tool_output(工具输出)
        tool --> tool_support --> tool_output
    end

    input(输入) --> LLM[大语言模型]
    LLM --> IF{是否需要调用工具}
    IF -->|否| output(一般输出)
    IF -->|是| tool
    tool_output -->|处理| agent_output(智能体输出)

我是这样写的,佬要不试一下

xinkeng0 commented 7 months ago

等我抽空会看看。