@@ -259,6 +259,31 @@ as_description_markup_convert (const gchar *markup, AsMarkupKind to_kind, GError
259
259
} else {
260
260
g_string_append_printf (str , "%s\n" , clean_text );
261
261
}
262
+ } else if ((g_strcmp0 ((gchar * ) iter -> name , "h2" ) == 0 ) || (g_strcmp0 ((gchar * ) iter -> name , "h3" ) == 0 )) {
263
+ g_autofree gchar * clean_text = NULL ;
264
+ g_autofree gchar * text_content = as_xml_get_node_value_raw (iter );
265
+ g_auto (GStrv ) spl = NULL ;
266
+
267
+ /* Apparently the element is empty, which is odd. But we better add it instead
268
+ * of completely ignoring it. */
269
+ if (text_content == NULL )
270
+ text_content = g_strdup ("" );
271
+
272
+ /* remove extra whitespaces and linebreaks */
273
+ clean_text = as_sanitize_text_spaces (text_content );
274
+
275
+ if (str -> len > 0 )
276
+ g_string_append (str , "\n" );
277
+
278
+ spl = as_markup_strsplit_words (clean_text , 100 );
279
+ if (spl != NULL ) {
280
+ for (guint i = 0 ; spl [i ] != NULL ; i ++ ) {
281
+ if (g_strcmp0 ((gchar * ) iter -> name , "h2" ) == 0 )
282
+ g_string_append_printf (str , "## %s\n" , clean_text );
283
+ else if (g_strcmp0 ((gchar * ) iter -> name , "h3" ) == 0 )
284
+ g_string_append_printf (str , "### %s\n" , clean_text );
285
+ }
286
+ }
262
287
} else if ((g_strcmp0 ((gchar * ) iter -> name , "ul" ) == 0 ) || (g_strcmp0 ((gchar * ) iter -> name , "ol" ) == 0 )) {
263
288
g_autofree gchar * item_c = NULL ;
264
289
gboolean is_ordered_list = g_strcmp0 ((gchar * ) iter -> name , "ol" ) == 0 ;
0 commit comments