md2api 0.5.0__tar.gz → 0.6.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,11 @@
1
+ FROM python:3.11-bookworm
2
+
3
+ COPY --from=ghcr.io/astral-sh/uv:0.10.4 /uv /uvx /bin/
4
+
5
+ RUN apt -y update && apt upgrade -qqy && apt -y install \
6
+ curl \
7
+ gcc \
8
+ git \
9
+ fish
10
+
11
+ RUN chsh -s /usr/bin/fish
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "dev",
3
+ "dockerFile": "Dockerfile",
4
+ "postCreateCommand": "/bin/sh ./.devcontainer/postCreateCommands.sh",
5
+ "customizations": {
6
+ "vscode": {
7
+ "extensions": [
8
+ "ms-azuretools.vscode-docker",
9
+ "ms-python.python",
10
+ "ms-python.vscode-pylance"
11
+ ],
12
+ "settings": {
13
+ "python.linting.flake8Enabled": true,
14
+ "python.formatting.provider": "black",
15
+ "[python]": {
16
+ "editor.formatOnSave": true,
17
+ "editor.codeActionsOnSave": {
18
+ "source.organizeImports": true
19
+ }
20
+ }
21
+ }
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/fish
2
+ uv sync --locked
@@ -0,0 +1,54 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ concurrency:
9
+ group: publish-${{ github.ref }}
10
+ cancel-in-progress: false
11
+
12
+ jobs:
13
+ publish:
14
+ name: Build and publish
15
+ runs-on: ubuntu-latest
16
+ environment:
17
+ name: pypi
18
+ url: https://pypi.org/p/md2api
19
+ permissions:
20
+ contents: read
21
+ id-token: write
22
+
23
+ steps:
24
+ - name: Check out repository
25
+ uses: actions/checkout@v4
26
+
27
+ - name: Set up Python
28
+ uses: actions/setup-python@v5
29
+ with:
30
+ python-version: "3.11"
31
+
32
+ - name: Set up uv
33
+ uses: astral-sh/setup-uv@v6
34
+ with:
35
+ version: "0.10.4"
36
+ enable-cache: true
37
+
38
+ - name: Verify tag matches package version
39
+ shell: bash
40
+ run: |
41
+ package_version="$(uv version --short)"
42
+ if [[ "${GITHUB_REF_NAME}" != "v${package_version}" ]]; then
43
+ echo "Tag ${GITHUB_REF_NAME} does not match package version ${package_version}."
44
+ exit 1
45
+ fi
46
+
47
+ - name: Install dependencies
48
+ run: uv sync --locked
49
+
50
+ - name: Build distributions
51
+ run: uv build
52
+
53
+ - name: Publish distributions
54
+ run: uv publish --trusted-publishing always
@@ -0,0 +1,135 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ pip-wheel-metadata/
24
+ share/python-wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+
30
+ # PyInstaller
31
+ # Usually these files are written by a python script from a template
32
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
33
+ *.manifest
34
+ *.spec
35
+
36
+ # Installer logs
37
+ pip-log.txt
38
+ pip-delete-this-directory.txt
39
+
40
+ # Unit test / coverage reports
41
+ htmlcov/
42
+ .tox/
43
+ .nox/
44
+ .coverage
45
+ .coverage.*
46
+ .cache
47
+ nosetests.xml
48
+ coverage.xml
49
+ *.cover
50
+ *.py,cover
51
+ .hypothesis/
52
+ .pytest_cache/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ target/
76
+
77
+ # Jupyter Notebook
78
+ .ipynb_checkpoints
79
+
80
+ # IPython
81
+ profile_default/
82
+ ipython_config.py
83
+
84
+ # pyenv
85
+ .python-version
86
+
87
+ # pipenv
88
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
90
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
91
+ # install all needed dependencies.
92
+ #Pipfile.lock
93
+
94
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
95
+ __pypackages__/
96
+
97
+ # Celery stuff
98
+ celerybeat-schedule
99
+ celerybeat.pid
100
+
101
+ # SageMath parsed files
102
+ *.sage.py
103
+
104
+ # Environments
105
+ .env
106
+ .venv
107
+ env/
108
+ venv/
109
+ ENV/
110
+ env.bak/
111
+ venv.bak/
112
+
113
+ # Spyder project settings
114
+ .spyderproject
115
+ .spyproject
116
+
117
+ # Rope project settings
118
+ .ropeproject
119
+
120
+ # mkdocs documentation
121
+ /site
122
+
123
+ # mypy
124
+ .mypy_cache/
125
+ .dmypy.json
126
+ dmypy.json
127
+
128
+ # Pyre type checker
129
+ .pyre/
130
+
131
+ # dist dir
132
+ docs/
133
+
134
+ .tokensave
135
+ .serena
md2api-0.6.0/PKG-INFO ADDED
@@ -0,0 +1,38 @@
1
+ Metadata-Version: 2.5
2
+ Name: md2api
3
+ Version: 0.6.0
4
+ Author-email: sumeshi <sum3sh1@protonmail.com>
5
+ License-Expression: MIT
6
+ License-File: LICENSE
7
+ Requires-Python: >=3.11
8
+ Requires-Dist: gitpython<4,>=3.1.43
9
+ Requires-Dist: markdown<4,>=3.6
10
+ Description-Content-Type: text/markdown
11
+
12
+ # md2api
13
+
14
+ sumeshi.github.io api converter
15
+
16
+ ## Development
17
+
18
+ ```console
19
+ $ uv sync --locked
20
+ $ uv run md2api . https://sumeshi.github.io posts
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ ```console
26
+ $ md2api . https://sumeshi.github.io posts
27
+ ```
28
+
29
+ ## Publishing
30
+
31
+ Configure a PyPI trusted publisher for the `sumeshi/md2api` repository, the
32
+ `publish.yml` workflow, and the `pypi` environment. Then push a tag that
33
+ matches the version in `pyproject.toml`:
34
+
35
+ ```console
36
+ $ git tag v0.6.0
37
+ $ git push origin v0.6.0
38
+ ```
md2api-0.6.0/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # md2api
2
+
3
+ sumeshi.github.io api converter
4
+
5
+ ## Development
6
+
7
+ ```console
8
+ $ uv sync --locked
9
+ $ uv run md2api . https://sumeshi.github.io posts
10
+ ```
11
+
12
+ ## Usage
13
+
14
+ ```console
15
+ $ md2api . https://sumeshi.github.io posts
16
+ ```
17
+
18
+ ## Publishing
19
+
20
+ Configure a PyPI trusted publisher for the `sumeshi/md2api` repository, the
21
+ `publish.yml` workflow, and the `pypi` environment. Then push a tag that
22
+ matches the version in `pyproject.toml`:
23
+
24
+ ```console
25
+ $ git tag v0.6.0
26
+ $ git push origin v0.6.0
27
+ ```
@@ -0,0 +1,24 @@
1
+ [project]
2
+ name = "md2api"
3
+ version = "0.6.0"
4
+ description = ""
5
+ authors = [
6
+ { name = "sumeshi", email = "sum3sh1@protonmail.com" },
7
+ ]
8
+ readme = "README.md"
9
+ license = "MIT"
10
+ requires-python = ">=3.11"
11
+ dependencies = [
12
+ "gitpython>=3.1.43,<4",
13
+ "markdown>=3.6,<4",
14
+ ]
15
+
16
+ [project.scripts]
17
+ md2api = 'md2api.run:main'
18
+
19
+ [build-system]
20
+ requires = ["hatchling"]
21
+ build-backend = "hatchling.build"
22
+
23
+ [tool.hatch.build.targets.wheel]
24
+ packages = ["src/md2api"]
@@ -1,6 +1,7 @@
1
1
  # coding: utf-8
2
2
  import sys
3
3
  import json
4
+ import re
4
5
  from pathlib import Path
5
6
  from typing import NamedTuple, Optional, Iterable
6
7
  from datetime import datetime
@@ -10,6 +11,9 @@ from git import Repo
10
11
  from markdown import Markdown
11
12
 
12
13
 
14
+ DEL_TAG_PATTERN = re.compile(r'</?del\b[^>]*>', flags=re.IGNORECASE)
15
+
16
+
13
17
  class Document(NamedTuple):
14
18
  title: str
15
19
  heading: str
@@ -33,7 +37,7 @@ def parse_markdown_filepaths(path: str) -> Iterable[Path]:
33
37
 
34
38
  def convert_markdown_to_html(text: str) -> str:
35
39
  md = Markdown(extensions=['tables', 'fenced_code'])
36
- return md.convert(text)
40
+ return DEL_TAG_PATTERN.sub('', md.convert(text))
37
41
 
38
42
 
39
43
  def get_lastcommit_date(path: str) -> Optional[datetime]:
@@ -124,10 +128,10 @@ def create_category_index(output_path: Path, documents: list[Document]):
124
128
  published_at=document.published_at
125
129
  )
126
130
 
127
- if category_name not in category_names.keys():
128
- category_names[category_name] = [postIndex]
131
+ if category_name in category_names.keys():
132
+ category_names[category_name].append(postIndex)
129
133
  else:
130
- category_names[category_name] = category_names[category_name].append(postIndex)
134
+ category_names[category_name] = [postIndex]
131
135
 
132
136
  for category, posts in category_names.items():
133
137
  document_path = index_path / Path(category) / Path('index.html')
md2api-0.6.0/uv.lock ADDED
@@ -0,0 +1,60 @@
1
+ version = 1
2
+ revision = 3
3
+ requires-python = ">=3.11"
4
+
5
+ [[package]]
6
+ name = "gitdb"
7
+ version = "4.0.12"
8
+ source = { registry = "https://pypi.org/simple" }
9
+ dependencies = [
10
+ { name = "smmap" },
11
+ ]
12
+ sdist = { url = "https://files.pythonhosted.org/packages/72/94/63b0fc47eb32792c7ba1fe1b694daec9a63620db1e313033d18140c2320a/gitdb-4.0.12.tar.gz", hash = "sha256:5ef71f855d191a3326fcfbc0d5da835f26b13fbcba60c32c21091c349ffdb571", size = 394684, upload-time = "2025-01-02T07:20:46.413Z" }
13
+ wheels = [
14
+ { url = "https://files.pythonhosted.org/packages/a0/61/5c78b91c3143ed5c14207f463aecfc8f9dbb5092fb2869baf37c273b2705/gitdb-4.0.12-py3-none-any.whl", hash = "sha256:67073e15955400952c6565cc3e707c554a4eea2e428946f7a4c162fab9bd9bcf", size = 62794, upload-time = "2025-01-02T07:20:43.624Z" },
15
+ ]
16
+
17
+ [[package]]
18
+ name = "gitpython"
19
+ version = "3.1.61"
20
+ source = { registry = "https://pypi.org/simple" }
21
+ dependencies = [
22
+ { name = "gitdb" },
23
+ ]
24
+ sdist = { url = "https://files.pythonhosted.org/packages/6f/61/3285044215fb596bf093e39ccb96ece0a1076a8ca57a61e069a6a33cdb1b/gitpython-3.1.61.tar.gz", hash = "sha256:f51c24d8c0f733a195447385f5774a5dfe8767f5acfd7994a33755644c6ecc95", size = 231680, upload-time = "2026-08-28T11:01:13.761Z" }
25
+ wheels = [
26
+ { url = "https://files.pythonhosted.org/packages/6f/5e/49cc172da4d0578644ba37cec5cb365b1fefc603b26edea9bcac1c7f830a/gitpython-3.1.61-py3-none-any.whl", hash = "sha256:8ab28c9da863cdd9e7d7694ec46cf3e6c9a12d8a30a1acd3447aec11975d530c", size = 222118, upload-time = "2026-08-28T11:01:12.262Z" },
27
+ ]
28
+
29
+ [[package]]
30
+ name = "markdown"
31
+ version = "3.10.3"
32
+ source = { registry = "https://pypi.org/simple" }
33
+ sdist = { url = "https://files.pythonhosted.org/packages/29/6f/da4c6aea59b3001f2e8c0ec7497475aadaf3b021c10cab5b2858f0f32b26/markdown-3.10.3.tar.gz", hash = "sha256:3589362618f743188b4d955b874402bc814f4f83f544dc207719f4baa7d9c45f", size = 372596, upload-time = "2026-07-30T19:05:29.005Z" }
34
+ wheels = [
35
+ { url = "https://files.pythonhosted.org/packages/64/69/4a5af2bc115a9a33fefe51709749de8262be3f9ba063d1753a837cdbc49c/markdown-3.10.3-py3-none-any.whl", hash = "sha256:fa6c92a00a4a3c98b22728c64a935ae1928250ae65058a6ded814d2cc29a4cea", size = 110757, upload-time = "2026-07-30T19:05:27.883Z" },
36
+ ]
37
+
38
+ [[package]]
39
+ name = "md2api"
40
+ version = "0.6.0"
41
+ source = { editable = "." }
42
+ dependencies = [
43
+ { name = "gitpython" },
44
+ { name = "markdown" },
45
+ ]
46
+
47
+ [package.metadata]
48
+ requires-dist = [
49
+ { name = "gitpython", specifier = ">=3.1.43,<4" },
50
+ { name = "markdown", specifier = ">=3.6,<4" },
51
+ ]
52
+
53
+ [[package]]
54
+ name = "smmap"
55
+ version = "5.0.3"
56
+ source = { registry = "https://pypi.org/simple" }
57
+ sdist = { url = "https://files.pythonhosted.org/packages/1f/ea/49c993d6dfdd7338c9b1000a0f36817ed7ec84577ae2e52f890d1a4ff909/smmap-5.0.3.tar.gz", hash = "sha256:4d9debb8b99007ae47165abc08670bd74cb74b5227dda7f643eccc4e9eb5642c", size = 22506, upload-time = "2026-03-09T03:43:26.1Z" }
58
+ wheels = [
59
+ { url = "https://files.pythonhosted.org/packages/c1/d4/59e74daffcb57a07668852eeeb6035af9f32cbfd7a1d2511f17d2fe6a738/smmap-5.0.3-py3-none-any.whl", hash = "sha256:c106e05d5a61449cf6ba9a1e650227ecfb141590d2a98412103ff35d89fc7b2f", size = 24390, upload-time = "2026-03-09T03:43:24.361Z" },
60
+ ]
md2api-0.5.0/PKG-INFO DELETED
@@ -1,14 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: md2api
3
- Version: 0.5.0
4
- Summary:
5
- License: MIT
6
- Author: sumeshi
7
- Author-email: sum3sh1@protonmail.com
8
- Requires-Python: >=3.11,<4.0
9
- Classifier: License :: OSI Approved :: MIT License
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: Programming Language :: Python :: 3.11
12
- Classifier: Programming Language :: Python :: 3.12
13
- Requires-Dist: GitPython (>=3.1.43,<4.0.0)
14
- Requires-Dist: markdown (>=3.6,<4.0)
@@ -1,20 +0,0 @@
1
- [tool.poetry]
2
- name = "md2api"
3
- version = "0.5.0"
4
- description = ""
5
- authors = ["sumeshi <sum3sh1@protonmail.com>"]
6
- license = "MIT"
7
-
8
- [tool.poetry.scripts]
9
- md2api = 'md2api.run:main'
10
-
11
- [tool.poetry.dependencies]
12
- python = "^3.11"
13
- markdown = "^3.6"
14
- GitPython = "^3.1.43"
15
-
16
- [tool.poetry.dev-dependencies]
17
-
18
- [build-system]
19
- requires = ["poetry>=0.12"]
20
- build-backend = "poetry.masonry.api"
File without changes