---
name: "mkd_doc_title"
section: "3"
platform: "linux"
package: "discount"
version: "3.0.2.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/mkd-functions"
---

# mkd\_doc\_title(3)

access and process Markdown documents.

Part of [mkd-functions(3)](/mkd-functions/3.md).

## NAME

**mkd\_functions** – access and process Markdown documents.

## LIBRARY

Markdown  (libmarkdown, -lmarkdown)

## SYNOPSIS

**#include \<mkdio.h\>**

*int*\

**mkd\_compile**(*MMIOT \*document*, *int flags*);

*int*\

**mkd\_css**(*MMIOT \*document*, *char \*\*doc*);

*int*\

**mkd\_generatecss**(*MMIOT \*document*, *FILE \*output*);

*int*\

**mkd\_document**(*MMIOT \*document*, *char \*\*doc*);

*int*\

**mkd\_generatehtml**(*MMIOT \*document*, *FILE \*output*);

*int*\

**mkd\_xhtmlpage**(*MMIOT \*document*, *int flags*, *FILE \*output*);

*int*\

**mkd\_toc**(*MMIOT \*document*, *char \*\*doc*);

*void*\

**mkd\_generatetoc**(*MMIOT \*document*, *FILE \*output*);

*void*\

**mkd\_cleanup**(*MMIOT\**);

*char\**\

**mkd\_doc\_title**(*MMIOT\**);

*char\**\

**mkd\_doc\_author**(*MMIOT\**);

*char\**\

**mkd\_doc\_date**(*MMIOT\**);

## DESCRIPTION

The **markdown** format supported in this implementation includes Pandoc-style header and inline  *\<style\>* blocks, and the standard [markdown(3)](/markdown/3.md) functions do not provide access to the data provided by either of those extensions. These functions give you access to that data, plus they provide a finer-grained way of converting *Markdown* documents into HTML.

Given a *MMIOT\** generated by **mkd\_in**() or **mkd\_string**(), **mkd\_compile**() compiles the document into *\<style\>*, *Pandoc*, and *html* sections.

Once compiled, the document can be examined and written by the **mkd\_css**(), **mkd\_document**(), **mkd\_generatecss**(), **mkd\_generatehtml**(), **mkd\_generatetoc**(), **mkd\_toc**(), **mkd\_xhtmlpage**(), **mkd\_doc\_title**(), **mkd\_doc\_author**(), and **mkd\_doc\_date**() functions.

**mkd\_css**() allocates a string and populates it with any \<style\> sections provided in the document, **mkd\_generatecss**() writes any \<style\> sections to the output, **mkd\_document**() points *text* to the text of the document and returns the size of the document, **mkd\_generatehtml**() writes the rest of the document to the output, and  **mkd\_doc\_title**(), **mkd\_doc\_author**(), **mkd\_doc\_date**() are used to read the contents of a Pandoc header, if any.

**mkd\_xhtmlpage**() writes a xhtml page containing the document.  The regular set of flags can be passed.

**mkd\_toc**() writes a document outline, in the form of a collection of nested lists with links to each header in the document, into a string allocated with **malloc**(), and returns the size.

**mkd\_generatetoc**() is like **mkd\_toc**(), except that it writes the document outline to the given *FILE\** argument.

**mkd\_cleanup**() deletes a *MMIOT\** after processing is done.

**mkd\_compile**() accepts the same flags that **markdown**() and **mkd\_string**() do;

- *MKD\_NOIMAGE*

  Do not process \`!\[\]' and remove *\<img\>* tags from the output.

- *MKD\_NOLINKS*

  Do not process \`\[\]' and remove *\<a\>* tags from the output.

- *MKD\_NOPANTS*

  Do not do Smartypants-style mangling of quotes, dashes, or ellipses.

- *MKD\_TAGTEXT*

  Process the input as if you were inside a html tag.  This means that no html tags will be generated, and  **mkd\_compile**() will attempt to escape anything that might terribly confuse a  web browser.

- *MKD\_NO\_EXT*

  Do not process any markdown pseudo-protocols when handing *\[\]\[\]* links.

- *MKD\_NOHEADER*

  Do not attempt to parse any Pandoc-style headers.

- *MKD\_TOC*

  Label all headers for use with the **mkd\_generatetoc**() function.

- *MKD\_1\_COMPAT*

  MarkdownTest\_1.0 compatibility flag; trim trailing spaces from the first line of code blocks and disable implicit reference links.

- *MKD\_NOSTRIKETHROUGH*

  Disable strikethrough support.

## RETURN VALUES

The function **mkd\_compile**() returns 1 in the case of success, or 0 if the document is already compiled. The function **mkd\_generatecss**() returns the number of bytes written in the case of success, or EOF if an error occurred.   The function **mkd\_generatehtml**() returns 0 on success, -1 on failure.

## SEE ALSO

[markdown(1)](/markdown/1.md), [markdown(3)](/markdown/3.md), [mkd-line(3)](/mkd-line/3.md), [markdown(7)](/markdown/7.md), [mkd-extensions(7)](/mkd-extensions/7.md), [mmap(2)](/mmap/2.md).

http://daringfireball.net/projects/markdown/syntax

## BUGS

Error handling is minimal at best.
