Skip to content

Commit

Permalink
Finalized Documentation for v0.15.0 (#101)
Browse files Browse the repository at this point in the history
* Added some comments

* Added deprecation warnings

* Added warning

* Cleaned up docs a little

* Updated version history

* Added docs PR
  • Loading branch information
jrg94 committed Mar 31, 2023
1 parent 550e7a0 commit ffd69e6
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 7 deletions.
9 changes: 6 additions & 3 deletions docs/docs/element-api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ The Element API

For users who want a little more control over how
their markdown is formatted, SnakeMD provides a low-level
API constructed from elements:
API constructed of elements.

Element Interface
-----------------

.. autoclass:: snakemd.Element
:members:
Expand Down Expand Up @@ -31,8 +34,8 @@ like the following Heading example:
The remainder of this section introduces the Block interface
as well as all of the Blocks currently available for use.

Block
^^^^^
Block Interface
^^^^^^^^^^^^^^^

All markdown blocks inherit from the Block interface.

Expand Down
7 changes: 6 additions & 1 deletion docs/version-history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ In an effort to keep history of all the documentation
for SnakeMD, we've included all old versions below
as follows:

* v0.14.0 [:pr:`84`, :pr:`86`, :pr:`89`, :pr:`90`, :pr:`91`]
* v0.15.0 [:pr:`97`, :pr:`98`, :pr:`99`, :pr:`101`]
* Moved README generation code to repo root as a script
* Expanded Heading constructor to support list of strings and Inline objects
* Migrated code block support from Paragraph class into new Code class

* v0.14.0 [:pr:`84`, :pr:`86`, :pr:`89`, :pr:`90`, :pr:`91`, :pr:`95`]
* Added Raw block for user formatted text
* Replaced InlineText with Inline
* Added Block and Inline classes
Expand Down
19 changes: 18 additions & 1 deletion snakemd/elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,14 @@ def __init__(self, text: Inline | str, level: int) -> None:


class Code(Block):
"""
A code block is a standalone block of syntax-highlighted code.
Code blocks can have generic highlighting or highlighting based
on their language.
.. versionadded:: 0.15.0
"""

def __init__(self, code: str | Code, lang: str = "generic"):
super().__init__()
self._code = code
Expand All @@ -624,8 +632,16 @@ class Paragraph(Block):
:param Iterable[Inline | str] content: a "list" of text objects to render as a paragraph
:param bool code: the code state of the paragraph;
set True to convert the paragraph to a code block (i.e., True -> ```code```)
.. deprecated:: 0.15.0
replaced in favor of the :class:`Code` block
:param str lang: the language of the code snippet;
invalid without the code flag set to True
.. deprecated:: 0.15.0
replaced in favor of the :class:`Code` block
:param bool quote: the quote state of the paragraph;
set True to convert the paragraph to a blockquote (i.e., True -> > quote)
"""
Expand All @@ -636,7 +652,8 @@ def __init__(self, content: Iterable[Inline | str], code: bool = False, lang: st
self._code = code
self._lang = lang
self._quote = quote
self._backticks = 3
if self._code:
warnings.warn("code block feature of Paragraph is a duplicate of the Code class")

@staticmethod
def _process_content(content) -> None:
Expand Down
2 changes: 0 additions & 2 deletions snakemd/templates.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from __future__ import annotations

from typing import Iterable

from .elements import Element, Heading, Inline, MDList, Verification


Expand Down

0 comments on commit ffd69e6

Please sign in to comment.