cliriculum.markdown¶
- class cliriculum.markdown.URLEntry(src, width, height, url, classes, text)¶
- class cliriculum.markdown.LogoEntry(src, title, classes, width: str = '18', height: str = '18')¶
A node intented to be added into the abstract syntax tree.
- src¶
- title¶
- width¶
- height¶
- Parameters:
src – Path to logo
title – A description
width (Optional[str]) – Size of width of image, by default “18”
height (Optional[str]) – Size of height of image, by default “18”
- class cliriculum.markdown.PeriodEntry(idx, start, end, logo, width, height, classes)¶
A node intented to be added into the abstract syntax tree.
- src¶
- title¶
- width¶
- height¶
- Parameters:
src – Path to logo
title – A description
width (Optional[str]) – Size of width of image, by default “18”
height (Optional[str]) – Size of height of image, by default “18”
- class cliriculum.markdown.LocationEntry(idx, classes, location)¶
A node intented to be added into the abstract syntax tree.
- src¶
- title¶
- width¶
- height¶
- Parameters:
src – Path to logo
title – A description
width (Optional[str]) – Size of width of image, by default “18”
height (Optional[str]) – Size of height of image, by default “18”
- class cliriculum.markdown.ImageEntry(src, width, height, id)¶
- class cliriculum.markdown.TextEntry(text: str, emphasis: str | None = None)¶
- Parameters:
text (str)
emphasis (str) – One of [“bold”, “italic”, None]
- class cliriculum.markdown.ContactBlock(children: List[SocialBlock | URLEntry | LogoEntry | TextEntry])¶
- class cliriculum.markdown.DescriptionBlock(children: List)¶
- class cliriculum.markdown.Class(classes)¶
- class cliriculum.markdown.Span(text: RawText)¶
- class cliriculum.markdown.ParseMd(path: str)¶
Parse Markdown Document and adds metadata to the tree depending on method called.
- doc¶
The tree representation of the document. Each public methods calls modifies this attribute
- top¶
Set on self.add_contact calls. If multiple calls, the top correspond to the last position of the last added Contact node. Default None.
- Type:
Union[bool, None]
- Parameters:
path (str) – Path to markdown file. The file will be parsed by mistletoe And its tree representation stored in self.doc.
- add_class()¶
Adds class to heading such as:
Heading {class="<i class="fa-solid fa-graduation-cap"}
- add_contact(contact: Contact, top: bool = True)¶
- Parameters:
contact (Contact)
top (bool, optional) – Whether to add to the top, by default True
Example
>>> from cliriculum.renderers import Renderer >>> from cliriculum.deserializers import Contact >>> from cliriculum.loaders import load_json >>> parsed = ParseMd("README.md") >>> dates = Contact(**load_json("contact.json")) >>> doc = parsed.add_contact(contact=contact).doc >>> with Renderer() as r: >>> html = r.render(doc)
- add_dates(dates: Dates)¶
Adds dates as a LogoEntry to the doc representation
- Parameters:
dates (Dates) – Instanciated Dates object.
- Returns:
An extended document with date added for Dates.periods object who share a level two ATX heading common id.
- Return type:
mistletoe.Document
Example
>>> from cliriculum.renderers import Renderer >>> from cliriculum.deserializers import Dates >>> from cliriculum.markdown import ParseMd >>> from cliriculum.loaders import load_json >>> parsed = ParseMd("README.md") >>> d = load_json("dates.json") >>> dates = Dates(d) >>> doc = parsed.add_dates(dates=dates).doc >>> with Renderer() as r: >>> html = r.render(doc)
- add_node_by_match_idx(nodes: Locations | Dates, new_node_class: Type[Any])¶
General method for adding node by matching idx. The matching is made on secondary level headers.
- Parameters:
Warning
- If you wish to render the parsed document, you have to make sure all new_node_class are registered
in the renderer.