diff --git a/.github/actions/waffles/requirements.txt b/.github/actions/waffles/requirements.txt
index 44c043b0..c6ee73ab 100644
--- a/.github/actions/waffles/requirements.txt
+++ b/.github/actions/waffles/requirements.txt
@@ -2,4 +2,4 @@ docopt==0.6.2
Flask==2.3.3
markupsafe==2.1.5
setuptools==75.6.0 # required for distutils in Python 3.12
-git+https://github.com/cds-snc/notifier-utils.git@53.0.1#egg=notifications-utils
+git+https://github.com/cds-snc/notifier-utils.git@53.0.2#egg=notifications-utils
diff --git a/notifications_utils/formatters.py b/notifications_utils/formatters.py
index c6c48d67..aa5d8034 100644
--- a/notifications_utils/formatters.py
+++ b/notifications_utils/formatters.py
@@ -31,10 +31,14 @@
FR_CLOSE = r"\[\[/fr\]\]" # matches [[/fr]]
EN_OPEN = r"\[\[en\]\]" # matches [[en]]
EN_CLOSE = r"\[\[/en\]\]" # matches [[/en]]
+RTL_OPEN = r"\[\[rtl\]\]" # matches [[rtl]]
+RTL_CLOSE = r"\[\[/rtl\]\]" # matches [[/rtl]]
FR_OPEN_LITERAL = "[[fr]]"
FR_CLOSE_LITERAL = "[[/fr]]"
EN_OPEN_LITERAL = "[[en]]"
EN_CLOSE_LITERAL = "[[/en]]"
+RTL_OPEN_LITERAL = "[[rtl]]"
+RTL_CLOSE_LITERAL = "[[/rtl]]"
BR_TAG = r"
"
@@ -621,6 +625,20 @@ def escape_lang_tags(_content: str) -> str:
return _content
+def escape_rtl_tags(_content: str) -> str:
+ """
+ Escape RTL tags into code tags in the content so mistune doesn't put them inside p tags. This makes it simple
+ to replace them afterwards, and avoids creating invalid HTML in the process
+ """
+
+ # check to ensure we have the same number of opening and closing tags before escaping tags
+ if _content.count(RTL_OPEN_LITERAL) == _content.count(RTL_CLOSE_LITERAL):
+ _content = _content.replace(RTL_OPEN_LITERAL, f"\n```\n{RTL_OPEN_LITERAL}\n```\n")
+ _content = _content.replace(RTL_CLOSE_LITERAL, f"\n```\n{RTL_CLOSE_LITERAL}\n```\n")
+
+ return _content
+
+
def add_language_divs(_content: str) -> str:
"""
Custom parser to add the language divs.
@@ -646,6 +664,27 @@ def remove_language_divs(_content: str) -> str:
return remove_tags(_content, FR_OPEN, FR_CLOSE, EN_OPEN, EN_CLOSE)
+def add_rtl_divs(_content: str) -> str:
+ """
+ Custom parser to add the language divs.
+
+ String replace language tags in-place
+ """
+
+ # check to ensure we have the same number of opening and closing tags before escaping tags
+ if _content.count(RTL_OPEN_LITERAL) == _content.count(RTL_CLOSE_LITERAL):
+ _content = _content.replace(RTL_OPEN_LITERAL, '