太长不看:本文将介绍如何将程序需求自动变成容易修改的流程图,使用的工具是Copilot和Markdown,下面是我得到的一个结果:
我提出的prompt是:
Given the following requirements, create mermaid diagram code that shows the relationship, use classDiagram and others in mermaid. Requirments: [Discription of the needOmmited for brevity]
以下是原文
Mermaid的使用非常简单,在你喜欢的markdown浏览器插件里搜索Mermaid安装即可,能够做到Markdown的所见即所得,无需LaTeX复杂的语法和Exhaustive的配置、编译。
Mermaid is a JavaScript library that allows you to create diagrams in Markdown. It is based on the Graphviz library, which is a graph visualization tool.
Why Mermaid?
In LaTeX, we can create diagrams using the TikZ package. But the syntax is not very intuitive and it is not easy to create complex diagrams.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}[
roundnode/.style={circle, draw=green!60, fill=green!5, very thick, minimum size=7mm},
squarednode/.style={rectangle, draw=red!60, fill=red!5, very thick, minimum size=5mm},
]
%Nodes
\node[squarednode] (maintopic) {2};
\node[roundnode] (uppercircle) [above=of maintopic] {1};
\node[squarednode] (rightsquare) [right=of maintopic] {3};
\node[roundnode] (lowercircle) [below=of maintopic] {4};
%Lines
\draw[->] (uppercircle.south) -- (maintopic.north);
\draw[->] (maintopic.east) -- (rightsquare.west);
\draw[->] (rightsquare.south) .. controls +(down:7mm) and +(right:7mm) .. (lowercircle.east);
\end{tikzpicture}
\end{document}
Using Mermaid, we can create the same diagram in Markdown:
(为了确保Markdown渲染器可以识别,需要在代码块的开头写个mermaid,即(省略我为了显示而用来占位的【啊】)
啊```mermaid
[some code]
啊```
graph LR
A((1)