Skip to content

Commit

Permalink
#154 Header h3 support in markdown (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
kalbfled authored Jul 29, 2024
1 parent 28404c4 commit 9f76473
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ The `./scripts/run_tests.sh` script runs all unit tests using [py.test](http://p

## Versioning

With the virtual environment active, run `python setup.py --version` to see the current version **on the current branch**. Use `git tag` to add release tags to commits, and push the tags.
With the virtual environment active, run `python setup.py --version` to see the current version **on the current branch**. Use `git tag` to add release tags to commits, if desired, and push the tags.

You can reference these release tags in requirements files in other repositories. See [notification-api](https://github.com/department-of-veterans-affairs/notification-api/blob/master/requirements-app.txt) for an example.
After merging changes in this repository, you must update notification-api to use the changes. Run `poetry update notification-utils` in an api branch, and then push the PR for approval/merge. The PR only should contain changes made to the lock file.

## E-mail Template Documentation

Expand Down
11 changes: 10 additions & 1 deletion notifications_utils/formatters.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,15 @@ def header(self, text, level, raw=None):
).format(
text
)
elif level == 3:
return (
'<h3 style="Margin: 0 0 15px 0; padding: 0; line-height: 26px; color: #323A45;'
'font-size: 20.8px; font-weight: bold; font-family: Helvetica, Arial, sans-serif;">'
'{}'
'</h3>'
).format(
text
)
return self.paragraph(text)

def hrule(self):
Expand Down Expand Up @@ -485,7 +494,7 @@ def header(self, text, level, raw=None):
self.linebreak(),
'-' * self.COLUMN_WIDTH,
))
elif level == 2:
elif level in (2, 3):
return ''.join((
self.linebreak() * 2,
text,
Expand Down
2 changes: 1 addition & 1 deletion notifications_utils/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2.0.1'
__version__ = '2.1.0'
19 changes: 19 additions & 0 deletions tests/test_formatters.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,25 @@ def test_level_2_header(markdown_function, expected):
assert markdown_function('## inset text') == expected


@pytest.mark.parametrize('markdown_function, expected', (
[
notify_email_markdown,
'<h3 style="Margin: 0 0 15px 0; padding: 0; line-height: 26px; color: #323A45;'
'font-size: 20.8px; font-weight: bold; font-family: Helvetica, Arial, sans-serif;">inset text</h3>'
],
[
notify_plain_text_email_markdown,
(
'\n'
'\ninset text'
'\n-----------------------------------------------------------------'
),
],
))
def test_level_3_header(markdown_function, expected):
assert markdown_function('### inset text') == expected


@pytest.mark.parametrize('markdown_function, expected', (
[
notify_letter_preview_markdown,
Expand Down

0 comments on commit 9f76473

Please sign in to comment.