renderMarkdown method

Future<String> renderMarkdown(
  1. String? input, {
  2. String mode = 'markdown',
  3. String? context,
})

Renders Markdown from the input.

mode is the markdown mode. (either 'gfm', or 'markdown') context is the repository context. Only take into account when mode is 'gfm'.

API docs: https://developer.github.com/v3/markdown/#render-an-arbitrary-markdown-document

Implementation

Future<String> renderMarkdown(
  String? input, {
  String mode = 'markdown',
  String? context,
}) {
  return github
      .request(
        'POST',
        '/markdown',
        body: GitHubJson.encode({
          'text': input,
          'mode': mode,
          'context': context,
        }),
      )
      .then((response) {
        return response.body;
      });
}