diff --git a/boards/mdx_neboard.py b/boards/mdx_neboard.py --- a/boards/mdx_neboard.py +++ b/boards/mdx_neboard.py @@ -119,6 +119,15 @@ class CodePattern(TextFormatter): format_right = '[/code]' +class HintPattern(TextFormatter): + name = 'hint' + preview_left = '' + preview_right = '' + + format_left = '[hint]' + format_right = '[/hint]' + + def render_reflink(tag_name, value, options, parent, context): result = '>>%s' % value @@ -165,6 +174,15 @@ def render_quote(tag_name, value, option return result +def render_hint(tag_name, value, options, parent, context): + if 'hint' in options: + hint = options['hint'] + result = '{}'.format(hint, value) + else: + result = value + return result + + def render_notification(tag_name, value, options, parent, content): username = value.lower() @@ -199,6 +217,7 @@ formatters = [ CommentPattern, StrikeThroughPattern, CodePattern, + HintPattern, ] @@ -218,6 +237,7 @@ class Parser: self.parser.add_formatter('post', render_reflink, strip=True) self.parser.add_formatter('quote', render_quote, strip=True) + self.parser.add_formatter('hint', render_hint, strip=True) self.parser.add_formatter('user', render_notification, strip=True) self.parser.add_formatter('tag', render_tag, strip=True) self.parser.add_formatter('spoiler', render_spoiler, strip=True) diff --git a/boards/static/css/base.css b/boards/static/css/base.css --- a/boards/static/css/base.css +++ b/boards/static/css/base.css @@ -164,3 +164,7 @@ textarea, input { .required-field:before { content: '* '; } + +.hint { + border-bottom: dashed 1px; +}