Skip to content

Custom the user mentions

agus makmun edited this page Feb 25, 2019 · 4 revisions

Here we using a custom markdown extensions to handle the user mentions.
If you see this martor/extensions/mention.py extension, you can see below lines:

if MARTOR_ENABLE_CONFIGS['mention'] == 'true':
    if username in [u.username for u in User.objects.exclude(is_active=False)]:

The markdown only show if user.is_active, and we using django.contrib.auth.models.User

For other think, this very possible if you want to custom your own extension and including at settings.py

MARTOR_MARKDOWN_EXTENSIONS = [
    ....

    # your custom mention extension
    'path.to.yourmention'
]
Clone this wiki locally