Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
run: poetry run coverage run -m pytest

- name: Coverage
run: poetry run coverage report
run: poetry run coverage report -m

- name: PyLint
run: poetry run pylint snakemd
Expand Down
30 changes: 30 additions & 0 deletions snakemd/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,41 @@ class Kind(Enum):
kinds of alerts that you might place in a
document.
"""

NOTE = auto()
"""
As the GitHub docs state, a note should provide
"useful information that users should know,
even when skimming content."
"""

TIP = auto()
"""
As the GitHub docs state, a tip should provide
"helpful advice for doing things better or
more easily."
"""

IMPORTANT = auto()
"""
As the GitHub docs state, an important alert should
provide "key information users need to know to
achieve their goal."
"""

WARNING = auto()
"""
As the GitHub docs state, a warning should provide
"urgent info that needs immediate user attention
to avoid problems."
"""

CAUTION = auto()
"""
As the GitHub docs state, a caution alert should
"[advise] about risks or negative outcomes of
certain actions."
"""

def __init__(
self,
Expand Down
8 changes: 7 additions & 1 deletion tests/document/test_document.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os

from snakemd import Document, Heading, HorizontalRule, Paragraph
from snakemd import Document, Heading, HorizontalRule, Paragraph, Alert

# Method tests (singles)

Expand Down Expand Up @@ -146,6 +146,12 @@ def test_add_block_horizontal_rule():
assert str(doc) == "***"


def test_add_alert():
doc = Document()
doc.add_alert("Do not the cat", Alert.Kind.CAUTION)
assert str(doc) == "> [!CAUTION]\n> Do not the cat"


def test_scramble_empty():
doc = Document()
doc.scramble()
Expand Down