Skip to content

argonism/mdfy-esa

Repository files navigation

mdfy-esa

pypi python release & publish workflow test status codecov

mdfy plugin for esa

Pre-requirement

You need set esa.io API token and set it to environment veriable ESA_ACCESS_TOKEN.

export ESA_ACCESS_TOKEN=YOUR_ACCESS_TOKEN

Usage

The mdfy-esa feature supports uploading of local images and files. With the EsaMdfier, images or files designated with MdImage or MdLink are uploaded automatically. Simply pass the MdImage with the local image path, and voila - it’s done!"

from mdfy import MdImage, MdLink, MdText
from mdfy_esa import EsaMdfier

esa_team = "your esa team name"
post_fullname = "post name as you like"
contents = [
    MdText("This is a test article."),
    MdImage(src="examples/test_image.png"),
    MdLink(url="examples/dummy.pdf"),
]

mdfier = EsaMdfier(post_fullname=post_fullname, esa_team=esa_team)
created_post_info = mdfier.write(contents=contents)

# created_post_info = {'number': 4418, 'name': 'My Test Article', 'full_name': 'note/me/My Test Article', 'wip': True, 'body_md': 'This is a test article.\n', 'body_html': '<p data- ...}
# see esa.io api document for detail
# https://docs.esa.io/posts/102#POST%20/v1/teams/:team_name/posts

You can also update an existing post using its post number!

from mdfy import MdImage, MdLink, MdText
from mdfy_esa import EsaMdfier

esa_team = "your esa team name"
post_number = 4930
contents = [
    MdText("NEW! This post is updated!"),
    MdText("This is a test article."),
    MdImage(src="examples/test_image.png"),
    MdLink(url="examples/dummy.pdf"),
]

mdfier = EsaMdfier(post_number=post_number, esa_team=esa_team)
updated_post_info = mdfier.write(contents=contents)

Features

  • TODO

Credits

This package was created with Cookiecutter and the waynerv/cookiecutter-pypackage project template.