Dunst
Lightweight notification daemon
Loading...
Searching...
No Matches
markup.h File Reference

Markup handling for notifications body. More...

+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  markup_mode { MARKUP_NULL , MARKUP_NO , MARKUP_STRIP , MARKUP_FULL }
 

Functions

char * markup_strip (char *str)
 Strip any markup from text; turn it in to plain text.
 
void markup_strip_a (char **str, char **urls)
 Remove HTML hyperlinks of a string.
 
void markup_strip_img (char **str, char **urls)
 Remove img-tags of a string.
 
char * markup_transform (char *str, enum markup_mode markup_mode)
 Transform the string in accordance with markup_mode and settings.ignore_newline
 

Detailed Description

Markup handling for notifications body.

License
BSD-3-Clause

Definition in file markup.h.

Enumeration Type Documentation

◆ markup_mode

enum markup_mode

Definition at line 14 of file markup.h.

Function Documentation

◆ markup_strip()

char * markup_strip ( char * str)

Strip any markup from text; turn it in to plain text.

For well-formed markup, the following two commands should be roughly equivalent:

out = markup_strip(in);
pango_parse_markup(in, -1, 0, NULL, &out, NULL, NULL);

However, pango_parse_markup() balks at invalid markup; markup_strip() shouldn't care if there is invalid markup.

Definition at line 230 of file markup.c.

◆ markup_strip_a()

void markup_strip_a ( char ** str,
char ** urls )

Remove HTML hyperlinks of a string.

Parameters
strThe string to replace a tags
urls(nullable) If any href-attributes found, an \n concatenated string of the URLs in format [<text between tags>] <href>

Definition at line 69 of file markup.c.

◆ markup_strip_img()

void markup_strip_img ( char ** str,
char ** urls )

Remove img-tags of a string.

If alt attribute given, use this as replacement.

Parameters
strThe string to replace img tags
urls(nullable) If any src-attributes found, an \n concatenated string of the URLs in format [<alt>] <src>

Definition at line 144 of file markup.c.

◆ markup_transform()

char * markup_transform ( char * str,
enum markup_mode markup_mode )

Transform the string in accordance with markup_mode and settings.ignore_newline

Definition at line 317 of file markup.c.