Misago
  • Introduction
  • Setup
    • Create server on Digital Ocean
    • Point domain at your server
    • Setup Misago on your Server
    • Upgrading your Misago to latest version
  • Settings
    • Accessing settings
    • Static settings reference
    • Dynamic settings reference
  • Coding style
  • GDPR Compliance Guide
  • Social authentication
  • User rank styles
  • Category styles
  • User authentication
  • Writing new admin actions
  • Permissions framework
  • View decorators
  • Context processors
  • Frontend context
  • Audit trail
  • Forms
  • Cache
  • Sending mails
  • Markup
  • Posting process
  • Profile fields
  • Threads types
  • Extending pages
  • Validating registrations
  • Validators
  • Search filters
  • Template tags
  • Shortcuts
  • View errors
  • Locales
Powered by GitBook
On this page
  • misago.markup.parse(text, author=None, allow_mentions=True, allow_links=True, allow_images=True, allow_blocks=True)
  • misago.markup.common_flavour(text, author=None, allow_mentions=True)
  • Extending Markup
  • extend_markdown(md)
  • process_result(result, soup)

Markup

Misago defines custom misago.markup module that provides facilities for parsing strings.

This module exposes following functions as its public API:

misago.markup.parse(text, author=None, allow_mentions=True, allow_links=True, allow_images=True, allow_blocks=True)

Parses Misago-flavoured Markdown text according to settings provided. Returns dictionary with following keys:

  • original_text - original text that was parsed

  • parsed_text - parsed text

  • markdown - markdown instance

misago.markup.common_flavour(text, author=None, allow_mentions=True)

Convenience function that wraps parse(). This function is used for parsing messages.

Extending Markup

To extend Misago markup, create custom module defining one or both of following functions:

extend_markdown(md)

Defining this function will allow you to register new extensions in markdown used to parse text.

process_result(result, soup)

Both functions should modify provided arguments in place.

Once your functions are done, add path to your module to MISAGO_MARKUP_EXTENSIONS setting like this:

# inside your settings.py...
MISAGO_MARKUP_EXTENSIONS = [
    'mymodule.markupextensions',
]
PreviousSending mailsNextPosting process

Last updated 7 years ago

This function is called to allow additional changes in result dict as well as extra instrospection and cleanup of parsed text, which is provided as class instance.

Beautiful Soup