Skip to content

AndrewSpangler/py_simple_readme

Repository files navigation

py_simple_readme 0.0.2

Quick, easy, navigatable readme generator


About^

I'm tired of hand-making big, navigatable readme.md files for github projects so I made this to make the process a lot less tedious. This readme was generated by this project.

Installation^

Available on pip - pip install py_simple_readme

Usage^

Example^

from py_simple_readme import readme_generator()
gen = readme_generator(title="Example", slogan="This goes below the title in the readme")
gen.set_changelog({"0.0.0": "Push"})
gen.add_heading_1("About")
gen.add_paragraph("A paragraph about the project.")
gen.add_heading_1("Installation")
gen.add_paragraph("Installation instructions")
gen.add_heading_1("Usage")
gen.add_paragraph("A paragraph about using the module")
with open("readme.md", "w+") as f:
f.write(gen.assemble())

readme_generator^

Simple object to handle the programatic generation of readme.md files

class readme_generator(object):
	def __init__(self, title: str = None, slogan: str = None, footnote_title: str = 'Notes:', footnote_heading_level: int = 2, numbered_toc: bool = False):
		...
	def add_blockquote(self, text: str, end: str = '\n\n'):
		"""Add a blockquoted paragraph at the current point in the readme body"""
	def add_bold(self, text: str, end: str = ''):
		"""Adds a bold piece of text at the current point in the readme body"""
	def add_code_block(self, code: str, lang: str = 'python', end: str = '\n', disable_prefix: bool = False):
		"""Add a block of code at the current point in the readme body"""
	def add_header_image(self, alt_text: str, url: str, replace_ok: bool = False):
		"""Adds an image to the images placed under the project title / slogan"""
	def add_heading(self, text: str, level: int = 1, end: str = '\n', add_toc: bool = True):
		"""Add a heading, set "add_toc" keyword to add a table of contents entry. Set "end" keyword to change the line ending."""
	def add_heading_1(self, text: str, **kwargs):
		"""Add a level 1 heading, set "add_toc" keyword to add a table of contents entry."""
	def add_heading_2(self, text: str, **kwargs):
		"""Add a level 2 heading, set "add_toc" keyword to add a table of contents entry."""
	def add_heading_3(self, text: str, **kwargs):
		"""Add a level 3 heading, set "add_toc" keyword to add a table of contents entry."""
	def add_heading_4(self, text: str, **kwargs):
		"""Add a level 4 heading, set "add_toc" keyword to add a table of contents entry."""
	def add_heading_5(self, text: str, **kwargs):
		"""Add a level 5 heading, set "add_toc" keyword to add a table of contents entry."""
	def add_heading_6(self, text: str, **kwargs):
		"""Add a level 6 heading, set "add_toc" keyword to add a table of contents entry."""
	def add_horizontal_rule(self):
		"""Adds a horizontal rule at the current point in the readme body"""
	def add_italic(self, text: str, end: str = ''):
		"""Adds italicized piece of text at the current point in the readme body"""
	def add_link(self, link: str, text: str = None, tooltip: str = None):
		"""Adds a link at the current point in the readme body"""
	def add_multi_blockquote(self, texts: list):
		"""Add multiple blockquoted paragraphs at the current point in the readme body"""
	def add_ordered_list(self, texts: list, indent: int = 0):
		"""Add an ordered (numbered) list as the current point in the readme body"""
	def add_paragraph(self, text: str, end: str = '\n\n'):
		"""Add a paragraph to the current point in the readme body"""
	def add_toc(self, title: str, end: str = '\n'):
		"""Add an entry to the table of contents at the current point in the readme body."""
	def add_unordered_list(self, texts: list, indent: int = 0):
		"""Add an unordered (non-numbered) list as the current point in the readme body"""
	def assemble(self):
		"""Generate the readme and return as a string."""
	def b(self, *args, **kwargs):
		"""Alias for add_bold"""
	def cb(self, *args, **kwargs):
		"""Alias for add_code_block"""
	def dd(self):
		"""Alias for decrease_toc_depth"""
	def decrease_toc_depth(self):
		"""Decrease table of contents depth"""
	def fn(self, text: str):
		"""Alias for insert_footnote"""
	def get_prefix(self):
		"""Returns the appropriate blockquote depth indicator"""
	def h1(self, *args, **kwargs):
		"""Alias for add_heading_1"""
	def h2(self, *args, **kwargs):
		"""Alias for add_heading_2"""
	def h3(self, *args, **kwargs):
		"""Alias for add_heading_3"""
	def h4(self, *args, **kwargs):
		"""Alias for add_heading_4"""
	def h5(self, *args, **kwargs):
		"""Alias for add_heading_5"""
	def h6(self, *args, **kwargs):
		"""Alias for add_heading_6"""
	def handle_class_list(self, classes: list, show_submodule: bool = False):
		"""Adds documentation for a list of classes at the current point in the readme body."""
	def handle_function_list(self, functions: list, show_submodule: bool = False):
		"""Adds documentation for a list of functions at the current point in the readme body."""
	def hr(self):
		"""Alias for add_horizontal_rule"""
	def i(self, *args, **kwargs):
		"""Alias for add_italic"""
	def id(self):
		"""Alias for increase_toc_depth"""
	def increase_toc_depth(self):
		"""Increase table of contents depth"""
	def insert_footnote(self, text: str):
		"""Inserts a footnote at the current point in the readme body."""
	def l(self, *args, **kwargs):
		"""Alias for add_link"""
	def ol(self, *args, **kwargs):
		"""Alias for add_ordered_list"""
	def p(self, *args, **kwargs):
		"""Alias for add_paragraph"""
	def q(self, *args, **kwargs):
		"""Alias for add_blockquote"""
	def save(self, path):
		"""Generate readme and save to a given location."""
	def set_changelog(self, changelog: dict):
		"""Set the changelog with a dictionary of version strings mapped to update info strings."""
	def set_header_images(self, images: dict, replace_ok: bool = False):
		"""Sets a list of header images from a dict that maps image_alt texts to image urls."""
	def set_slogan(self, slogan: str):
		"""Set readme slogan. This will appear directly below the readme title if set."""
	def toc(self, *args, **kwargs):
		"""Alias for add_toc"""
	def ul(self, *args, **kwargs):
		"""Alias for add_unordered_list"""

Changelog^

0.0.2^

Add show_submodule argument to function/class documenter function

0.0.1^

Fix PyPi readme

0.0.0^

Push

Generated with py_simple_readme

About

Quick, easy, navigatable readme generator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages