updated codeblock in index
This commit is contained in:
parent
e1fbccf20d
commit
60600a9a21
1 changed files with 17 additions and 2 deletions
|
@ -7,6 +7,21 @@ title: My First Post
|
|||
- This post has some content.
|
||||
|
||||
```python
|
||||
def foo():
|
||||
return "bar"
|
||||
def md_to_html(
|
||||
content: str,
|
||||
resolve_links: bool = False,
|
||||
source: Path | None = None,
|
||||
layout: Layout | None = None,
|
||||
item_map: dict[Path, Item] | None = None,
|
||||
) -> str:
|
||||
if resolve_links and (source is None or layout is None or item_map is None):
|
||||
raise TypeError(
|
||||
"md_to_html() missing source and ctx when resolve_links is true"
|
||||
)
|
||||
parser = Parser()
|
||||
ast = parser.parse(content)
|
||||
renderer = ZonaRenderer(
|
||||
resolve_links, source, layout=layout, item_map=item_map
|
||||
)
|
||||
return renderer.render(ast)
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue