as-markup: AppStream-glib Reference Manual

## as-markup as-markup — Functions for managing AppStream description markup |

## Stability Level

Stable, unless otherwise indicated

## Functions

gchar * | as_markup_convert_simple ()
gchar * | as_markup_convert ()
gchar * | as_markup_convert_full ()
gboolean | as_markup_validate ()
gchar ** | as_markup_strsplit_words ()
gchar * | as_markup_import ()

## Types and Values

enum | AsMarkupConvertFormat
enum | AsMarkupConvertFlag

## Includes

    #include <appstream-glib.h>

## Description

These functions are used internally to libappstream-glib, and some may be useful to user-applications.

## Functions

### as_markup_convert_simple ()

    gchar *
    as_markup_convert_simple (const gchar *markup,
                              GError **error);

Converts an XML description into a printable form.

#### Parameters

markup | the text to copy. |
error | A GError or `NULL` |

#### Returns

a newly allocated `NULL` terminated string.

[transfer full]

Since: 0.1.0

### as_markup_convert ()

    gchar *
    as_markup_convert (const gchar *markup,
                       AsMarkupConvertFormat format,
                       GError **error);

Converts an XML description into a printable form.

#### Parameters

markup | the text to copy. |
format | the AsMarkupConvertFormat, e.g. `AS_MARKUP_CONVERT_FORMAT_MARKDOWN` |
error | A GError or `NULL` |

#### Returns

a newly allocated `NULL` terminated string.

[transfer full]

Since: 0.3.5

### as_markup_convert_full ()

    gchar *
    as_markup_convert_full (const gchar *markup,
                            AsMarkupConvertFormat format,
                            AsMarkupConvertFlag flags,
                            GError **error);

Converts an XML description into a printable form.

#### Parameters

markup | the text to copy. |
format | the AsMarkupConvertFormat, e.g. `AS_MARKUP_CONVERT_FORMAT_MARKDOWN` |
flags | the AsMarkupConvertFlag, e.g. `AS_MARKUP_CONVERT_FLAG_IGNORE_ERRORS` |
error | A GError or `NULL` |

#### Returns

a newly allocated `NULL` terminated string.

[transfer full]

Since: 0.3.5

### as_markup_validate ()

    gboolean
    as_markup_validate (const gchar *markup,
                        GError **error);

Validates some markup.

#### Parameters

markup | the text to validate |
error | A GError or `NULL` |

#### Returns

`TRUE` if the appstream description was valid

Since: 0.5.1

### as_markup_strsplit_words ()

    gchar **
    as_markup_strsplit_words (const gchar *text,
                              guint line_len);

Splits up a long line into an array of smaller strings, each being no longer than `line_len` . Words are not split.

#### Parameters

text | the text to split. |
line_len | the maximum length of the output line |

#### Returns

lines, or `NULL` in event of an error.

[transfer full]

Since: 0.3.5

### as_markup_import ()

    gchar *
    as_markup_import (const gchar *text,
                      AsMarkupConvertFormat format,
                      GError **error);

Imports text and converts to AppStream markup.

#### Parameters

text | the text to import. |
format | the AsMarkupConvertFormat, e.g. `AS_MARKUP_CONVERT_FORMAT_SIMPLE` |
error | A GError or `NULL` |

#### Returns

appstream markup, or `NULL` in event of an error.

[transfer full]

Since: 0.5.11

## Types and Values

### enum AsMarkupConvertFormat

The format used when converting to or from AppStream descriptions.

#### Members

AS_MARKUP_CONVERT_FORMAT_SIMPLE | UTF-8 text |
AS_MARKUP_CONVERT_FORMAT_MARKDOWN | Markdown format |
AS_MARKUP_CONVERT_FORMAT_NULL | No output |
AS_MARKUP_CONVERT_FORMAT_APPSTREAM | AppStream (passthrough) |
AS_MARKUP_CONVERT_FORMAT_HTML | HyperText Markup Language |

### enum AsMarkupConvertFlag

The flags used when converting descriptions from AppStream-style.

#### Members

AS_MARKUP_CONVERT_FLAG_NONE | No flags set |
AS_MARKUP_CONVERT_FLAG_IGNORE_ERRORS | Ignore errors where possible |