Modules
EsaMdfier
¶
Bases: Mdfier
A class to modify Markdown files and upload images to Esa.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
post_fullname |
Optional[str]
|
The full name of the post to modify. |
None
|
post_number |
Optional[int]
|
The number of the post to update. |
None
|
esa_team |
Optional[str]
|
The name of the Esa team. Defaults to None. you can set this param or the environment variable ESA_TEAM. |
None
|
Raises:
Type | Description |
---|---|
ValueError
|
If esa_team param or the environment variable ESA_TEAM is not set. |
Examples:
>>> from mdfy import MdImage, MdLink, MdText
>>> from mdfy_esa import EsaMdfier
>>> contents = [
... MdText("This is a test article."),
... MdImage(src="example/test_image.png"),
... MdLink(url="example/dummy.pdf"),
... ]
>>> mdfier = EsaMdfier(post_fullname="note/me/My Test Article", esa_team="test_team")
>>> mdfier.write(contents=contents)
Source code in mdfy_esa/mdfy_esa.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
|
__init__(post_fullname=None, post_number=None, esa_team=None)
¶
Initializes the EsaMdfier class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
post_fullname |
Optional[str]
|
The path to the post to modify. |
None
|
post_number |
Optional[int]
|
The number of the post to update. |
None
|
esa_team |
Optional[str]
|
The name of the Esa team. Defaults to None. |
None
|
Source code in mdfy_esa/mdfy_esa.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
|
stringify_element(element)
¶
Converts the given element to a string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
element |
Union[MdElement, str]
|
The element to convert. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The converted string. |
Source code in mdfy_esa/mdfy_esa.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
|
write(contents, post_params={}, **payloads)
¶
post the given Markdown content to esa.io.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
contents |
Union[List[Union[str, MdElement]], MdElement]
|
The Markdown content to write to the file. |
required |
post_params |
Dict[str, Any]
|
Additional parameters for the post. see https://docs.esa.io/posts/102#POST%20/v1/teams/:team_name/posts. Defaults to {}. |
{}
|
**payloads |
Optional[Dict[str, Any]]
|
Additional parameters for piyo see https://github.com/argonism/piyo/blob/master/piyo/client.py#L112. |
{}
|
Source code in mdfy_esa/mdfy_esa.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
|