Skip to content

Commit

Permalink
feat: make section a parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
Citymonstret committed Feb 2, 2024
1 parent cdf306c commit 4d0bb38
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/core/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ in which case, a successful result is returned as a completed future, and a fail
exceptionally completed future.
Returning a future is useful when the parsing needs to take place on a specific thread.

{{ snippet("UUIDParser.java", "Example Parser") }}
{{ snippet("UUIDParser.java", title = "Example Parser") }}

1. The command sender type.

Expand Down
6 changes: 4 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,14 @@ def javadoc(link: str, title: str = None) -> str:
return '[`{title}`](<{link}> "Click to open the JavaDoc")'.format(link=link, title=title)

@env.macro
def snippet(path: str, title: str = None) -> str:
def snippet(path: str, section: str = "snippet", title: str = None) -> str:
if title is None:
title = path
if section is not None:
path = path + ":" + section

return """
```java title="{title}"
--8<-- "{path}:snippet"
--8<-- "{path}"
```
""".format(path=path, title=title)

0 comments on commit 4d0bb38

Please sign in to comment.