-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.md.jinja2
323 lines (256 loc) · 14.9 KB
/
README.md.jinja2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
<!--
{% set project_name='mdremotifier' %}
{% set project_name_proper='mdremotifier' %}
{% set last_unstable_release=shell('tomlq -r -e \'.["tool"]["mdremotifier-project-metadata"]["last_unstable_release"]\' pyproject.toml',
include_args=False) | trim %}
{% set last_stable_release=shell('tomlq -r -e \'.["tool"]["mdremotifier-project-metadata"]["last_stable_release"]\' pyproject.toml',
include_args=False) | trim %}
{% set tested_python_versions=shell('python -m yq -r -c \'[.jobs["build-and-test"]["strategy"]["matrix"]["python-version"][].gh] | join(", ")\' .github/workflows/build-and-test.yml',
include_args=False) | trim %}
{% set badge_color='0A1E1E' %}
-->
# <div align="center">![{{project_name}}][1]</div>
<div align="center">
</div>
<div align="center">
<!-- Icons from https://lucide.dev/icons/users -->
<!-- Icons from https://lucide.dev/icons/laptop-minimal -->
![**Audience:** Developers][2] ![**Platform:** Linux][3]
</div>
<p align="center">
<strong>
<a href="#-features">🎇Features</a>
•
<a href="#-installation">🏠Installation</a>
•
<a href="#-usage">🚜Usage</a>
•
<a href="#-command-line-options">💻CLI</a>
•
<a href="#-examples">💡Examples</a>
•
<a href="#-requirements">✅Requirements</a>
</strong>
</p>
<div align="center">
![Top language][4] [![GitHub License][5]][6] [![PyPI - Version][7]][8]
[![Python Version][9]][8]
**CLI to replace `./image.png` to `raw.githubusercontent.com` remote URL in
README.md**
</div>
---
<div align="center">
| | Status | Stable | Unstable | |
| ----------------- | --------------------------- | ------------------------- | ------------------------- | ------------------ |
| **[Master][10]** | [![Build and Test][11]][12] | [![since tagged][13]][14] | | ![last commit][15] |
| **[Develop][16]** | [![Build and Test][17]][12] | [![since tagged][18]][19] | [![since tagged][20]][21] | ![last commit][22] |
</div>
<img src="./.github/demo.gif" alt="Demo" width="100%">
## ❔ What
What {{project_name_proper}} does:
Turn this ({{ path('./mdremotifier/examples/EXAMPLE.md', link='md') }}):
<!--{{ rawsnippet('./mdremotifier/examples/EXAMPLE.md', backtickify='md', decomentify='nl') }}-->
Into this
({{ path('./mdremotifier/examples/EXAMPLE.remotified.md', link='md') }}):
<!--{{ rawsnippet('./mdremotifier/examples/EXAMPLE.remotified.md', backtickify='md', decomentify='nl') }}-->
This is useful for uploading `README.md` files to third-party sites, like the
npmjs.com registry, or pypi.org registry, because these registries will break
the local images in your README when displayed on their sites.
See <https://pypi.org/project/mdremotifier/>, notice how all of the images are
not broken.
## 🎇 Features
- 📷🔗📡🌐🖼️ Replace local URLs with raw.githubusercontent.com URLs.
## 🏠 Installation
```bash
# Install from pypi (https://pypi.org/project/{{project_name}}/)
pip install {{project_name}}
# Install from git (https://github.com/realazthat/{{project_name}})
pip install git+https://github.com/realazthat/{{project_name}}.git@v{{last_stable_release}}
```
## 🚜 Usage
Example README: ({{path('./mdremotifier/examples/EXAMPLE.md', link='md')}}):
<!--{{ rawsnippet('./mdremotifier/examples/EXAMPLE.md', backtickify='md', decomentify='nl') }}-->
Generating the README:
<!--{{ shell('python -m mdremotifier.cli -i ./mdremotifier/examples/EXAMPLE.md --url-prefix https://raw.githubusercontent.com/realazthat/mdremotifier/master/ -o - 2>/dev/null', backtickify='bash', decomentify='nl') }}-->
## 💻 Command Line Options
<!--{{ shell('python -m mdremotifier.cli --help',
rich='README.help.generated.svg',
rich_alt='Output of `python -m mdremotifier.cli --help`',
rich_bg_color='black',
rich_term='xterm-256color',
rich_cols=160,
decomentify='nl') }}-->
## 💡 Examples
- {{project_name_proper}}'s own `README`:
- Original: {{path('./README.md', link='md')}}.
- Remotified: {{path('./.github/README.remotified.md', link='md')}}.
- Generation script: {{path('./scripts/generate-readme.sh', link='md')}}.
- Example:
- Original: {{path('./mdremotifier/examples/EXAMPLE.md', link='md')}}.
- Remotified:
{{path('./mdremotifier/examples/EXAMPLE.remotified.md', link='md')}}.
- Generation script:
{{path('./mdremotifier/examples/example.sh', link='md')}}.
<!-- TODO: Rebuild this for mdremotifier
- Projects using {{project_name_proper}}:
- [realazthat/snipinator](https://github.com/realazthat/snipinator), See
[snipinator/README.md.jinja2](https://github.com/realazthat/snipinator/blob/61cb88593baa099dc375cf5fd40679e4be673fc5/README.md.jinja2).
- [github.com/realazthat/changeguard](https://github.com/realazthat/changeguard),
See
[changeguard/README.md.jinja2](https://github.com/realazthat/changeguard/blob/87d5104b52e651bb9195a3d46dd7f050acbcb534/README.md.jinja2).
- [github.com/realazthat/comfy-catapult](https://github.com/realazthat/comfy-catapult),
See
[comfy-catapult/README.md.jinja2](https://github.com/realazthat/comfy-catapult/blob/ff353d48b25fa7b9c35fa11b31d5f2b3039c41c8/README.md.jinja2).
- [github.com/realazthat/comfylowda](https://github.com/realazthat/comfylowda),
See
[comfylowda/README.md.jinja2](https://github.com/realazthat/comfylowda/blob/e01a32c38107aa0b89ccea21c4678d193a186a78/README.md.jinja2).
- [github.com/realazthat/excalidraw-brute-export-cli](https://github.com/realazthat/excalidraw-brute-export-cli),
See
[excalidraw-brute-export-cli/README.md.jinja2](https://github.com/realazthat/excalidraw-brute-export-cli/blob/54a3b5b08b644e61c721ab565c576094234c5cc7/README.md.jinja2).
-->
## ✅ Requirements
- Linux-like environment
- Why: Uses pexpect.spawn().
- Python 3.8+
- Why: Some dev dependencies require Python 3.8+.
### Tested Platforms
- WSL2 Ubuntu 20.04, Python `{{rawsnippet('./.python-version') | trim}}`.
- Ubuntu 20.04, Python `{{tested_python_versions}}`, tested in GitHub Actions
workflow ([build-and-test.yml](./.github/workflows/build-and-test.yml)).
## 🤏 Versioning
We use SemVer for versioning. For the versions available, see the tags on this
repository.
## 🔑 License
This project is licensed under the MIT License - see the
{{path('./LICENSE.md', link='md')}} file for details.
## 🙏 Thanks
Main libraries used in {{project_name}} are:
- Markdown AST: [mistletoe](https://github.com/miyuchina/mistletoe).
- Colorful CLI help: [rich-argparse](https://github.com/hamdanal/rich-argparse).
## 🤝 Related Projects
Not complete, and not necessarily up to date. Make a PR
([contributions](#-contributions)) to insert/modify.
| Project | Stars | Last Update | Language | Platform | Similarity X Obviousness |
| ------------------------------------------------- | ----- | ------------ | -------- | -------- | ------------------------ |
| [bdashore3/remark-github-images][23] | 0 | `2022/12/29` | JS | CLI | ⭐⭐⭐⭐⭐ |
| [laobie/WriteMarkdownLazily][24] | 36 | `2024/01/06` | Python | CLI | ⭐⭐⭐⭐ |
| [crh19970307/mdul][25] | 1 | `2020/02/01` | Python | CLI | ⭐⭐⭐⭐ |
| [SkyLee424/Go-MarkDown-Image-Transfer-Helper][26] | 0 | `2024/03/25` | Go | CLI | ⭐⭐⭐⭐ |
| [jen6/imgo][27] | 0 | `2020/03/18` | Pyhon | CLI | ⭐⭐⭐⭐ |
| [chocoluffy/lazy-markdown][28] | 0 | `2016/11/20` | Python | CLI | ⭐⭐⭐⭐ |
| [loheagn/gopic][29] | 0 | `2021/11/24` | Go | CLI | ⭐⭐⭐⭐ |
| [Undertone0809/imarkdown][30] | 57 | `2024/01/06` | Python | Python | ⭐⭐⭐ |
| [ravgeetdhillon/markdown-imgur-upload][31] | 1 | `2022/03/26` | Python | CLI | ⭐⭐⭐ |
## 🫡 Contributions
### Development environment: Linux-like
- For running `pre.sh` (Linux-like environment).
- From {{path('./.github/dependencies.yml', link='md')}}, which is used for
the GH Action to do a fresh install of everything:
{{shell('python -m yq --yaml-output \'.dev\' .github/dependencies.yml',
include_args=False,
backtickify='yaml',
indented=4
)}}
- Requires `pyenv`, or an exact matching version of python as in
{{path('.python-version', link='md')}} (which is currently
`{{ rawsnippet('.python-version') }}`).
- `jq`, ([installation](https://jqlang.github.io/jq/)) required for
[yq](https://github.com/kislyuk/yq), which is itself required for our
{{path('./README.md', link='md')}} generation, which uses `tomlq` (from the
[yq](https://github.com/kislyuk/yq) package) to include version strings from
{{path('./pyproject.toml', link='md')}}.
- act (to run the GH Action locally):
- Requires nodejs.
- Requires Go.
- docker.
- Generate animation:
- docker
### Commit Process
1. (Optionally) Fork the `develop` branch.
2. Stage your files: `git add path/to/file.py`.
3. `bash ./scripts/pre.sh`, this will format, lint, and test the code.
4. `git status` check if anything changed (generated
{{path('./README.md', link='md')}} for example), if so, `git add` the
changes, and go back to the previous step.
5. `git commit -m "..."`.
6. Make a PR to `develop` (or push to develop if you have the rights).
## 🔄🚀 Release Process
These instructions are for maintainers of the project.
1. In the `develop` branch, run `bash {{path('./scripts/pre.sh')}}` to ensure
everything is in order.
2. In the `develop` branch, bump the version in
{{path('./pyproject.toml', link='md')}}, following semantic versioning
principles. Also modify the `last_unstable_release` and `last_stable_release`
in the `[tool.{{project_name}}-project-metadata]` table as appropriate. Run
`bash ./scripts/pre.sh` to ensure everything is in order.
3. In the `develop` branch, commit these changes with a message like
`"Prepare release X.Y.Z"`. (See the contributions section
[above](#commit-process)).
4. Merge the `develop` branch into the `master` branch:
`git checkout master && git merge develop --no-ff`.
5. `master` branch: Tag the release: Create a git tag for the release with
`git tag -a vX.Y.Z -m "Version X.Y.Z"`.
6. Publish to PyPI: Publish the release to PyPI with
`bash ./scripts/deploy-to-pypi.sh`.
7. Push to GitHub: Push the commit and tags to GitHub with
`git push && git push --tags`.
8. The `--no-ff` option adds a commit to the master branch for the merge, so
refork the develop branch from the master branch:
`git checkout develop && git merge master`.
9. Push the develop branch to GitHub: `git push origin develop`.
[1]: ./.github/logo-exported.svg
[2]:
https://img.shields.io/badge/Audience-Developers-{{badge_color}}?style=plastic&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJsdWNpZGUgbHVjaWRlLXVzZXJzIj48cGF0aCBkPSJNMTYgMjF2LTJhNCA0IDAgMCAwLTQtNEg2YTQgNCAwIDAgMC00IDR2MiIvPjxjaXJjbGUgY3g9IjkiIGN5PSI3IiByPSI0Ii8+PHBhdGggZD0iTTIyIDIxdi0yYTQgNCAwIDAgMC0zLTMuODciLz48cGF0aCBkPSJNMTYgMy4xM2E0IDQgMCAwIDEgMCA3Ljc1Ii8+PC9zdmc+
[3]:
https://img.shields.io/badge/Platform-Linux-{{badge_color}}?style=plastic&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJsdWNpZGUgbHVjaWRlLWxhcHRvcC1taW5pbWFsIj48cmVjdCB3aWR0aD0iMTgiIGhlaWdodD0iMTIiIHg9IjMiIHk9IjQiIHJ4PSIyIiByeT0iMiIvPjxsaW5lIHgxPSIyIiB4Mj0iMjIiIHkxPSIyMCIgeTI9IjIwIi8+PC9zdmc+
[4]:
https://img.shields.io/github/languages/top/realazthat/{{project_name}}.svg?&cacheSeconds=28800&style=plastic&color={{badge_color}}
[5]:
https://img.shields.io/github/license/realazthat/{{project_name}}?style=plastic&color={{badge_color}}
[6]: ./LICENSE.md
[7]:
https://img.shields.io/pypi/v/{{project_name}}?style=plastic&color={{badge_color}}
[8]: https://pypi.org/project/{{project_name}}/
[9]:
https://img.shields.io/pypi/pyversions/{{project_name}}?style=plastic&color={{badge_color}}
[10]: https://github.com/realazthat/{{project_name}}/tree/master
[11]:
https://img.shields.io/github/actions/workflow/status/realazthat/{{project_name}}/build-and-test.yml?branch=master&style=plastic
[12]:
https://github.com/realazthat/{{project_name}}/actions/workflows/build-and-test.yml
[13]:
https://img.shields.io/github/commits-since/realazthat/{{project_name}}/v{{last_stable_release}}/master?style=plastic
[14]:
https://github.com/realazthat/{{project_name}}/compare/v{{last_stable_release}}...master
[15]:
https://img.shields.io/github/last-commit/realazthat/{{project_name}}/master?style=plastic
[16]: https://github.com/realazthat/{{project_name}}/tree/develop
[17]:
https://img.shields.io/github/actions/workflow/status/realazthat/{{project_name}}/build-and-test.yml?branch=develop&style=plastic
[18]:
https://img.shields.io/github/commits-since/realazthat/{{project_name}}/v{{last_stable_release}}/develop?style=plastic
[19]:
https://github.com/realazthat/{{project_name}}/compare/v{{last_stable_release}}...develop
[20]:
https://img.shields.io/github/commits-since/realazthat/{{project_name}}/v{{last_unstable_release}}/develop?style=plastic
[21]:
https://github.com/realazthat/{{project_name}}/compare/v{{last_unstable_release}}...develop
[22]:
https://img.shields.io/github/last-commit/realazthat/{{project_name}}/develop?style=plastic
[23]:
https://github.com/bdashore3/remark-github-images
"Documentation is non-existent, but code looks very similar to mdremotifier"
[24]: https://github.com/laobie/WriteMarkdownLazily "Uploads to cloud."
[25]: https://github.com/crh19970307/mdul "Uploads to sm.ms"
[26]:
https://github.com/SkyLee424/Go-MarkDown-Image-Transfer-Helper
"Upload to Qiniu Cloud"
[27]: https://github.com/jen6/imgo "Upload to Google Drive"
[28]:
https://github.com/chocoluffy/lazy-markdown
"Uploads to LeanCloud, readme is a bit unclear"
[29]: https://github.com/loheagn/gopic "Upload to cloud, not clear which cloud"
[30]: https://github.com/Undertone0809/imarkdown "Doesn't yet have a CLI."
[31]:
https://github.com/ravgeetdhillon/markdown-imgur-upload
"Upload to imgur, a bit annoying because it requires you to put the images into a particular directory"