Go to the documentation of this file.
36 "\"theme\": \"base\","
37 "\"curve\": \"monotoneX\","
38 "\"rankSpacing\": 10,"
39 "\"nodeSpacing\": 10,"
40 "\"themeCSS\": \"__###__\","
41 "\"fontFamily\": \"Roboto,Segoe UI,sans-serif\","
42 "\"themeVariables\": { "
43 "\"clusterBkg\": \"white\", "
44 "\"primaryBorderColor\": \"gray\", "
45 "\"lineColor\": \"gray\", "
46 "\"secondaryTextColor\": \"gray\", "
47 "\"tertiaryBorderColor\": \"gray\", "
48 "\"primaryTextColor\": \"#666\", "
49 "\"secondaryTextColor\": \"red\" "
52 "\"subGraphTitleMargin\": { \"top\": -15, \"bottom\": 20 }, "
53 "\"diagramPadding\": 20, "
54 "\"curve\": \"monotoneX\" "
60 "\"theme\": \"base\","
61 "\"layout\": \"elk\","
62 "\"curve\": \"monotoneX\","
63 "\"rankSpacing\": 65,"
64 "\"nodeSpacing\": 60,"
65 "\"themeCSS\": \"__###__\","
66 "\"fontFamily\": \"Roboto,Segoe UI,sans-serif\","
67 "\"themeVariables\": { "
68 "\"clusterBkg\": \"white\", "
69 "\"primaryBorderColor\": \"gray\", "
70 "\"lineColor\": \"gray\", "
71 "\"secondaryTextColor\": \"gray\", "
72 "\"tertiaryBorderColor\": \"gray\", "
73 "\"primaryTextColor\": \"#666\", "
74 "\"secondaryTextColor\": \"red\" "
77 "\"diagramPadding\": 12, "
78 "\"entityPadding\": 4, "
79 "\"minEntityWidth\": 150, "
80 "\"minEntityHeight\": 20, "
81 "\"curve\": \"monotoneX\" "
89 "--ff-colvideo: #6eaa7b; "
90 "--ff-colaudio: #477fb3; "
91 "--ff-colsubtitle: #ad76ab; "
92 "--ff-coltext: #666; "
94 " g.nodes g.node.default rect.basic.label-container, "
95 " g.nodes g.node.default path { "
98 " stroke-width: 1px !important; "
99 " stroke: #e9e9e9 !important; "
100 " fill: url(#ff-filtergradient) !important; "
101 " filter: drop-shadow(0px 0px 5.5px rgba(0, 0, 0, 0.05)); "
102 " fill: white !important; "
105 " .relationshipLine { "
109 " filter: drop-shadow(0px 0px 3px rgba(0, 0, 0, 0.2)); "
112 " g.node.default g.label.name foreignObject > div > span > p, "
113 " g.nodes g.node.default g.label:not(.attribute-name, .attribute-keys, .attribute-type, .attribute-comment) foreignObject > div > span > p { "
114 " font-size: 0.95rem; "
115 " font-weight: 500; "
116 " text-transform: uppercase; "
117 " min-width: 5.5rem; "
118 " margin-bottom: 0.5rem; "
122 " .edgePaths path { "
123 " marker-end: none; "
124 " marker-start: none; "
159 #define OFFSET(x) offsetof(MermaidContext, x)
162 {
"link_coloring",
"enable colored links (requires Mermaid >= 11.5)",
OFFSET(enable_link_colors),
AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1 },
246 if (parent_sec_data.subgraph_start_incomplete) {
247 if (parent_buf->len > 0)
256 #define MM_INDENT() writer_printf(tfc, "%*c", mmc->indent_level * 2, ' ')
269 if (tfc->
level == 0) {
280 directive =
av_strireplace(diag_directive,
"__###__", css_buf.str);
285 av_log(tfc,
AV_LOG_ERROR,
"Unable to locate the required token (__###__) in the html template.");
290 for (uint64_t
i = 0;
i < length;
i++)
299 writer_put_str(tfc,
" gradient_def@{ shape: text, label: \"<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"1\" height=\"1\"><defs><linearGradient id=\"ff-filtergradient\" x1=\"0%\" y1=\"0%\" x2=\"0%\" y2=\"100%\"><stop offset=\"0%\" style=\"stop-color:hsl(0, 0%, 98.6%); \"/><stop offset=\"50%\" style=\"stop-color:hsl(0, 0%, 100%); \"/><stop offset=\"100%\" style=\"stop-color:hsl(0, 0%, 96.5%); \"/></linearGradient><radialGradient id=\"ff-radgradient\" cx=\"50%\" cy=\"50%\" r=\"100%\" fx=\"45%\" fy=\"40%\"><stop offset=\"25%\" stop-color=\"hsl(0, 0%, 100%)\" /><stop offset=\"100%\" stop-color=\"hsl(0, 0%, 96%)\" /></radialGradient></defs></svg>\" }\n");
336 av_log(tfc,
AV_LOG_ERROR,
"Unable to write subgraph start. Missing id field. Section: %s", section->
name);
430 if (sec_data.current_is_textblock) {
433 if (sec_data.section_id) {
441 }
else if (sec_data.current_is_stadium) {
463 if (sec_data.section_id) {
476 if (sec_data.src_id && sec_data.dest_id
482 av_bprintf(&mmc->
link_buf,
"\n %s %s-%s-%s@==", sec_data.src_id, sec_data.section_type, sec_data.src_id, sec_data.dest_id);
503 switch (sec_data.link_type) {
526 if (tfc->
level == 0) {
532 av_log(tfc,
AV_LOG_ERROR,
"Unable to locate the required token (__###__) in the html template.");
535 token_pos += strlen(
"__###__");
540 if (tfc->
level == 1) {
552 const char *str,
int64_t num,
const int is_int)
605 const char *col_type;
610 if (sec_data.section_id && !strcmp(str, sec_data.section_id))
612 else if (sec_data.dest_id && !strcmp(str, sec_data.dest_id))
614 else if (sec_data.src_id && !strcmp(str, sec_data.src_id))
660 .priv_class = &mermaid_class,
665 .
name =
"mermaidhtml",
674 .priv_class = &mermaid_class,
#define AV_BPRINT_SIZE_UNLIMITED
#define AV_TEXTFORMAT_SECTION_PRINT_TAGS
...
AVBPrint link_buf
print buffer for writing diagram links
#define AV_TEXTFORMAT_FLAG_IS_DIAGRAM_FORMATTER
@ AV_TEXTFORMAT_LINKTYPE_SRCDEST
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
char * av_stristr(const char *s1, const char *s2)
Locate the first case-independent occurrence in the string haystack of the string needle.
static av_cold int has_link_pair(const AVTextFormatContext *tfc, const char *src, const char *dest)
const char * src_id_key
name of the key to be used as the source id for diagram connections
@ AV_DIAGRAMTYPE_ENTITYRELATIONSHIP
const char * context_type
static void writer_printf(AVTextFormatContext *wctx, const char *fmt,...)
#define AV_TEXTFORMAT_SECTION_FLAG_IS_SUBGRAPH
...
@ AV_TEXTFORMAT_LINKTYPE_ONETOMANY
static void mermaid_print_int(AVTextFormatContext *tfc, const char *key, int64_t value)
DEFINE_FORMATTER_CLASS(mermaid)
static const char * init_directive
int level
current level, starting from 0
#define AV_ESCAPE_FLAG_STRICT
Escape only specified special characters.
@ AV_TEXTFORMAT_LINKTYPE_MANYTOONE
const AVTextFormatter avtextformatter_mermaid
static void mermaid_print_str(AVTextFormatContext *tfc, const char *key, const char *value)
static av_cold int mermaid_init_html(AVTextFormatContext *tfc)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
void * priv
private data for use by the filter
int subgraph_start_incomplete
Describe the class of an AVClass context structure.
static void writer_w8(AVTextFormatContext *wctx, int b)
void av_bprint_escape(AVBPrint *dstbuf, const char *src, const char *special_chars, enum AVEscapeMode mode, int flags)
Escape the content in src and append it to dstbuf.
static const AVTextFormatSection * tf_get_parent_section(AVTextFormatContext *tfc, int level)
Safely access the parent section.
char * av_strireplace(const char *str, const char *from, const char *to)
Locale-independent strings replace.
@ AV_TEXTFORMAT_LINKTYPE_MANYTOMANY
AVDiagramConfig * diagram_config
#define SECTION_MAX_NB_LEVELS
int(* init)(AVBSFContext *ctx)
static void mermaid_print_section_footer(AVTextFormatContext *tfc)
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
#define i(width, name, range_min, range_max)
static void mermaid_print_value(AVTextFormatContext *tfc, const char *key, const char *str, int64_t num, const int is_int)
#define AV_TEXTFORMAT_SECTION_FLAG_IS_SHAPE
...
AVBPrint section_pbuf[SECTION_MAX_NB_LEVELS]
generic print buffer dedicated to each section, used by various formatters
static const char * theme_css_er
const AVTextFormatter avtextformatter_mermaidhtml
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
const char * linktype_key
name of the key to be used as the link type for diagram connections (AVTextFormatLinkType)
static void mermaid_print_section_header(AVTextFormatContext *tfc, const void *data)
AVDiagramType diagram_type
static void writer_put_str(AVTextFormatContext *wctx, const char *str)
unsigned nb_link_captions[SECTION_MAX_NB_LEVELS]
generic print buffer dedicated to each section,
static void set_str(const char **dst, const char *src)
static av_cold int mermaid_init(AVTextFormatContext *tfc)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default value
static av_cold void uninit(AVBitStreamFilterContext *ctx)
struct MermaidContext::section_data section_data[SECTION_MAX_NB_LEVELS]
@ AV_TEXTFORMAT_LINKTYPE_ONETOONE
const char * dest_id_key
name of the key to be used as the target id for diagram connections
void av_bprintf(AVBPrint *buf, const char *fmt,...)
#define AV_TEXTFORMAT_SECTION_FLAG_HAS_LINKS
...
const char * html_template
void av_bprint_clear(AVBPrint *buf)
Reset the string to "" but keep internal allocated data.
static av_cold int mermaid_uninit(AVTextFormatContext *tfc)
const char * section_type
static void mermaid_subgraph_complete_start(MermaidContext *mmc, AVTextFormatContext *tfc, int level)
const char * id_key
name of the key to be used as the id
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
@ AV_ESCAPE_MODE_BACKSLASH
Use backslash escaping.
static const AVTextFormatSection * tf_get_section(AVTextFormatContext *tfc, int level)
Safely validate and access a section at a given level.
void av_diagram_init(AVTextFormatContext *tfc, AVDiagramConfig *diagram_config)
AVTextFormatLinkType link_type
static const AVOption mermaid_options[]
static const char * init_directive_er