SirVer / ultisnips

UltiSnips - The ultimate snippet solution for Vim. Send pull requests to SirVer/ultisnips!
GNU General Public License v3.0
7.55k stars 691 forks source link

A simple snippet for mermaid within Markdown - NOT WORKING #1536

Closed Damianus500 closed 1 year ago

Damianus500 commented 1 year ago

I have been using Ultisnips for years to write markdown documents. First, Thank you for this wonderful plugin.

Recently, I started to embed mermaid diagram within markdown.

For that, I wrote this simple snippet "xmm". It confused me why this rather simple snippet does not work.

snippet xmm "Mermaid Codes"

flowchart TD
S0([$1]) ==> A0($2) & B0($3)
A0 ==> A1("Pagan, <br/>  ☞  enemies <br/> ☞  idols")
B0 ==> B1[[Discernment]]

endsnippet

My system is:

OS: Pop!_OS 22.04 LTS x86_64 Host: HP Laptop 15s-eq0xxx Kernel: 6.4.6-76060406-generic Uptime: 1 hour, 30 mins Packages: 3250 (dpkg), 66 (flatpak) Shell: bash 5.1.16 Resolution: 1920x1080 DE: GNOME 42.5 WM: Mutter WM Theme: Pop Theme: Materia-dark-compact [GTK2/3] Icons: gnome [GTK2/3] Terminal: tmux CPU: AMD Ryzen 7 3700U with Radeon Vega Mobile Gfx (8) @ 2.300GHz GPU: AMD ATI Radeon Vega Series / Radeon Vega Mobile Series Memory: 6441MiB / 13881MiB

Any help or hint much appreciated!

Damianus

Expected behavior:

Actual behavior:

Steps to reproduce

1. 2. 3.


SirVer commented 1 year ago

What is not working? Can you please fix the syntax of the markdown in the issue?Am 28.08.2023 um 05:43 schrieb Da Ming @.***>: I have been using Ultisnips for years to write markdown documents. First, Thank you for this wonderful plugin. Recently, I started to embed mermaid diagram within markdown. For that, I wrote this simple snippet "xmm". It confused me why this rather simple snippet does not work. snippet xmm "Mermaid Codes"

  flowchart TD

S0([$1]) ==> A0($2) & B0($3) A0 ==> A1("Pagan,
☞ enemies
☞ idols") B0 ==> B1[[Discernment]]

endsnippet My system is: OS: Pop!_OS 22.04 LTS x86_64 Host: HP Laptop 15s-eq0xxx Kernel: 6.4.6-76060406-generic Uptime: 1 hour, 30 mins Packages: 3250 (dpkg), 66 (flatpak) Shell: bash 5.1.16 Resolution: 1920x1080 DE: GNOME 42.5 WM: Mutter WM Theme: Pop Theme: Materia-dark-compact [GTK2/3] Icons: gnome [GTK2/3] Terminal: tmux CPU: AMD Ryzen 7 3700U with Radeon Vega Mobile Gfx (8) @ 2.300GHz GPU: AMD ATI Radeon Vega Series / Radeon Vega Mobile Series Memory: 6441MiB / 13881MiB Any help or hint much appreciated! Damianus

Expected behavior: Actual behavior: Steps to reproduce

Operating System: Vim Version: UltiSnips Version: Python inside Vim: Docker repo/vimrc:

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

Damianus500 commented 1 year ago

Hi SirVer:

My mistake. Sorry. I ddin't state my problem!

https://github.com/SirVer/ultisnips/assets/83386270/becd52b3-7506-421d-aac2-19378ab5c6da

In the video, my snippets mdhead and xco worked without hassle.

BUT snippet 'xmm' does not expand to anything.

I enclose a simpler 'xmm' for your perusal:

snippet xmm "Mermaid Codes"

flowchart TD
S0([$1]) ==> A0($2) & B0($3)
A0 ==> A1("Pagan, <br/>  ☞  enemies <br/> ☞  idols")
B0 ==> B1[[Discernment]]

endsnippet

Thanks for your help.

Damianus

SirVer commented 1 year ago

I had trouble understanding what the problematic snippet was, since github keeps rendering a diagram whenever you paste it. But I figured it out now. The problem are the backticks `. A single one is interpreted as a shell script, hence most of your snippet is executed as a shell script and its output put in.

Try escaping all backticks with a backslash:

\`\`\` here goes the rest of your snippet 

\`\`\`