diff --git a/jrnl/messages.py b/jrnl/messages.py index 6d3ea094..335c7b54 100644 --- a/jrnl/messages.py +++ b/jrnl/messages.py @@ -140,6 +140,11 @@ class MsgText(Enum): No entries to delete, because the search returned no results """ + # --- Formats --- # + HeadingsPastH6 = """ + Headings increased past H6 on export - {date} {title} + """ + class Message(NamedTuple): text: MsgText diff --git a/jrnl/plugins/markdown_exporter.py b/jrnl/plugins/markdown_exporter.py index 11f748b6..ae10bf3f 100644 --- a/jrnl/plugins/markdown_exporter.py +++ b/jrnl/plugins/markdown_exporter.py @@ -4,13 +4,14 @@ import os import re -import sys - -from jrnl.color import RESET_COLOR -from jrnl.color import WARNING_COLOR from .text_exporter import TextExporter +from jrnl.output import print_msg +from jrnl.messages import Message +from jrnl.messages import MsgText +from jrnl.messages import MsgType + class MarkdownExporter(TextExporter): """This Exporter can convert entries and journals into Markdown.""" @@ -63,10 +64,12 @@ class MarkdownExporter(TextExporter): newbody = newbody + os.linesep if warn_on_heading_level is True: - print( - f"{WARNING_COLOR}WARNING{RESET_COLOR}: " - f"Headings increased past H6 on export - {date_str} {entry.title}", - file=sys.stderr, + print_msg( + Message( + MsgText.HeadingsPastH6, + MsgType.WARNING, + {"date": date_str, "title": entry.title}, + ) ) return f"{heading} {date_str} {entry.title}\n{newbody} "