parser.enter_span = md_enter_span;
parser.leave_span = md_leave_span;
parser.text = md_text;
+ parser.flags = MD_FLAG_UNDERLINE;
if(md_parse(markdown.ptr, markdown.length, &parser, &data)) {
cxMempoolFree(mp);
case MD_SPAN_STRONG: return EDITOR_STYLE_STRONG;
case MD_SPAN_A: return EDITOR_STYLE_LINK;
case MD_SPAN_CODE: return EDITOR_STYLE_CODE;
+ case MD_SPAN_U: return EDITOR_STYLE_UNDERLINE;
}
return NULL;
}
cxMapPut(markdown_tags, EDITOR_STYLE_CODE_BLOCK, &((MDTag){" ", NULL}));
cxMapPut(markdown_tags, EDITOR_STYLE_STRONG, &((MDTag){"**", "**"}));
cxMapPut(markdown_tags, EDITOR_STYLE_EMPHASIS, &((MDTag){"*", "*"}));
+ cxMapPut(markdown_tags, EDITOR_STYLE_UNDERLINE, &((MDTag){"_", "_"}));
cxMapPut(markdown_tags, EDITOR_STYLE_CODE, &((MDTag){"`", "`"}));
}
style->strong = TRUE;
}
+static void tagstyle_underline(MDActiveStyles *style, GtkTextTag *tag) {
+ style->underline = TRUE;
+}
+
static void tagstyle_code(MDActiveStyles *style, GtkTextTag *tag) {
style->code = TRUE;
}
g_object_set_data(G_OBJECT(tag), "set_style", (void*)tagstyle_strong);
gtk_text_tag_table_add(table, tag);
+ tag = gtk_text_tag_new(EDITOR_STYLE_UNDERLINE);
+ g_object_set(tag, "underline", PANGO_UNDERLINE_SINGLE, NULL);
+ g_object_set_data(G_OBJECT(tag), "set_style", (void*)tagstyle_underline);
+ gtk_text_tag_table_add(table, tag);
+
tag = gtk_text_tag_new(EDITOR_STYLE_CODE);
g_object_set(tag, "family", "Monospace", "background", "#efefef", NULL);
g_object_set_data(G_OBJECT(tag), "set_style", (void*)tagstyle_code);
snprintf(buf, 32, "_%d", anon_tag++);
cxMapPut(map, buf, t);
}
+ g_value_unset(&name_value);
tags = tags->next;
}
return map;
}
void note_text_style_set_underline(NoteModel *note, UiBool enabled) {
-
+ if(!editor_set_style(note->text, EDITOR_STYLE_UNDERLINE, enabled)) {
+ ui_set(note->textnote_underline, !enabled);
+ }
}
void note_text_style_set_code(NoteModel *note, UiBool enabled) {