diff --git a/docs/.pages b/docs/.pages new file mode 100644 index 0000000..b62c7a3 --- /dev/null +++ b/docs/.pages @@ -0,0 +1,3 @@ +nav: + - msglc.md + - API: api \ No newline at end of file diff --git a/docs/api/LazyReader.md b/docs/api/LazyReader.md new file mode 100644 index 0000000..af0873e --- /dev/null +++ b/docs/api/LazyReader.md @@ -0,0 +1,3 @@ +# LazyReader + +::: msglc.reader.LazyReader \ No newline at end of file diff --git a/docs/color_scheme.css b/docs/color_scheme.css new file mode 100644 index 0000000..ebdef54 --- /dev/null +++ b/docs/color_scheme.css @@ -0,0 +1,6 @@ +[data-md-color-scheme="slate"] { + --md-primary-fg-color: #23252f; + --md-default-bg-color: #2e303e; + --md-typeset-a-color: #8e91aa; + --md-accent-fg-color: #658eda +} \ No newline at end of file diff --git a/docs/msglc.md b/docs/msglc.md new file mode 100644 index 0000000..ff6e82a --- /dev/null +++ b/docs/msglc.md @@ -0,0 +1,2 @@ +# msglc + diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..f2ff97f --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,57 @@ +site_name: msglc +site_author: Theodore Chang +copyright: Copyright © 2024 Theodore Chang +repo_url: "https://github.com/TLCFEM/msglc" +theme: + name: material + features: + - navigation.tabs + - navigation.footer + palette: + - media: "(prefers-color-scheme: light)" + scheme: default + primary: white + accent: pink + toggle: + icon: material/lightbulb-outline + name: Turn off the lights + - media: "(prefers-color-scheme: dark)" + scheme: slate + toggle: + icon: material/lightbulb + name: Turn on the lights +extra_css: + - color_scheme.css +markdown_extensions: + - admonition + - pymdownx.arithmatex: + generic: true + - pymdownx.highlight: + linenums: true + anchor_linenums: true + use_pygments: true + auto_title: true + - pymdownx.betterem + - pymdownx.caret + - pymdownx.critic + - pymdownx.details + - pymdownx.inlinehilite + - pymdownx.keys + - pymdownx.mark + - pymdownx.smartsymbols + - pymdownx.superfences: + custom_fences: + - name: mermaid + class: mermaid + format: !!python/name:pymdownx.superfences.fence_code_format + - pymdownx.tilde +plugins: + - search + - awesome-pages + - mkdocstrings: + default_handler: python + handlers: + python: + options: + show_source: true + docstring_style: sphinx \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index d217f37..d3725c7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,6 +36,9 @@ dev = [ "pytest-benchmark", "pytest-asyncio", "ruff", + "mkdocs-material", + "mkdocs-awesome-pages-plugin", + "mkdocstrings[python]", ] numpy = [ "numpy", diff --git a/src/msglc/reader.py b/src/msglc/reader.py index 42c6328..dd94642 100644 --- a/src/msglc/reader.py +++ b/src/msglc/reader.py @@ -431,17 +431,17 @@ def __init__( Please inherit the `Unpacker` class from the `unpacker.py`. There are already several unpackers available using different libraries. - .. highlight:: python - .. code-block:: python - class CustomUnpacker(Unpacker): - def decode(self, data: bytes): - # provide the decoding logic - ... - - with LazyReader("file.msg", unpacker=CustomUnpacker()) as reader: - # read the data + ```py + class CustomUnpacker(Unpacker): + def decode(self, data: bytes): + # provide the decoding logic ... + with LazyReader("file.msg", unpacker=CustomUnpacker()) as reader: + # read the data + ... + ``` + :param buffer_or_path: the buffer or path to the file :param counter: the counter object for tracking the number of bytes read :param cached: whether to cache the data