Skip to content

Commit 52c7a67

Browse files
CopilotEndlessTrax
andauthored
Modernize README with improved structure and visual design (#11)
* Initial plan * Reimagine and rewrite README with modern formatting and improved structure Co-authored-by: EndlessTrax <17141891+EndlessTrax@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: EndlessTrax <17141891+EndlessTrax@users.noreply.github.com>
1 parent a8be357 commit 52c7a67

File tree

1 file changed

+193
-50
lines changed

1 file changed

+193
-50
lines changed

README.md

Lines changed: 193 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,220 @@
1-
# Python Template Snippets
1+
<div align="center">
2+
<img src="logo.png" alt="Python Template Snippets Logo" width="200"/>
3+
4+
# Python Template Snippets
25

3-
This VS Code snippet extension includes snippets for both the Jinja2 and Django template engines.
6+
**Supercharge your template development workflow**
47

5-
Quickly add snippets to HTML template files in your project.
8+
A comprehensive VS Code snippet collection for **Jinja2** and **Django** template engines.
69

7-
If there is a snippet that is not included in this extension, please open an issue on the [repo here](https://github.com/EndlessTrax/python-template-snippets).
10+
[![GitHub stars](https://img.shields.io/github/stars/EndlessTrax/python-template-snippets?style=social)](https://github.com/EndlessTrax/python-template-snippets)
11+
[![VS Code Marketplace](https://img.shields.io/badge/VS%20Code-Marketplace-blue?logo=visual-studio-code)](https://marketplace.visualstudio.com/items?itemName=RickyWhite.python-template-snippets)
12+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
813

9-
## Setup
14+
</div>
1015

11-
Just hit install!
16+
---
17+
18+
## 🚀 Why Use This Extension?
19+
20+
Writing template code can be tedious with all those brackets, tags, and syntax. This extension eliminates the repetitive typing by providing **smart, tab-completion snippets** for common Jinja2 and Django template patterns.
21+
22+
**Stop typing this:**
23+
```html
24+
{% for item in items %}
25+
<!-- your code -->
26+
{% endfor %}
27+
```
28+
29+
**Start typing this:**
30+
```
31+
ptfor → Tab → Fill in the blanks!
32+
```
33+
34+
### ✨ Features
35+
36+
- 🎯 **20+ carefully crafted snippets** for Jinja2 and Django
37+
-**Lightning-fast** - Type `pt` prefix and let IntelliSense do the rest
38+
- 🎨 **Smart cursor positioning** - Jump to exactly where you need to type
39+
- 🔄 **Multi-cursor support** - Tab between placeholders seamlessly
40+
- 🛠️ **Framework-agnostic** - Works with Flask, Django, FastAPI, and any Python web framework
41+
- 📦 **Zero configuration** - Works out of the box
42+
43+
---
44+
45+
## 📦 Installation
46+
47+
### From VS Code Marketplace (Recommended)
48+
49+
1. Open VS Code
50+
2. Press `Ctrl+P` / `Cmd+P`
51+
3. Type `ext install RickyWhite.python-template-snippets`
52+
4. Press Enter and reload VS Code
53+
54+
### Manual Installation
55+
56+
1. Download the latest `.vsix` from [Releases](https://github.com/EndlessTrax/python-template-snippets/releases)
57+
2. Open VS Code
58+
3. Go to Extensions (`Ctrl+Shift+X` / `Cmd+Shift+X`)
59+
4. Click the `...` menu → `Install from VSIX`
60+
5. Select the downloaded file
61+
62+
---
63+
64+
## 🎯 Quick Start
65+
66+
1. Open any HTML file in VS Code
67+
2. Type `pt` to see available snippets
68+
3. Select a snippet from the IntelliSense menu (or type the full prefix)
69+
4. Press `Tab` to trigger the snippet
70+
5. Fill in the placeholders and press `Tab` to jump between them
71+
72+
### 💡 Pro Tip
73+
Enable tab completion in your VS Code settings for the best experience:
74+
```json
75+
{
76+
"editor.tabCompletion": "on"
77+
}
78+
```
79+
80+
---
81+
82+
## 📚 Snippet Reference
83+
84+
All snippets use the `pt` prefix (short for "Python Template"). Here's the complete reference:
85+
86+
### 🌐 General Snippets
87+
*Works with both Jinja2 and Django*
88+
89+
| Prefix | Description | Output |
90+
|--------|-------------|---------|
91+
| `ptnew` | New HTML template file | Complete template with extends and blocks |
92+
| `ptvar` | Template variable | `{{ variable }}` |
93+
| `ptfilt` | Variable with filter | `{{ variable \| filter }}` |
94+
| `ptcode` | Code block tag | `{% code %}` |
95+
| `ptblock` | Block tag | `{% block name %}...{% endblock %}` |
96+
| `ptext` | Extends tag | `{% extends 'base.html' %}` |
97+
| `ptsup` | Super function | `{{ super() }}` |
98+
| `ptfor` | For loop | `{% for item in items %}...{% endfor %}` |
99+
| `ptif` | If statement | `{% if condition %}...{% endif %}` |
100+
| `ptifel` | If/else statement | `{% if %}...{% else %}...{% endif %}` |
101+
| `ptelif` | If/elif/else statement | `{% if %}...{% elif %}...{% else %}...{% endif %}` |
102+
| `ptwith` | With statement | `{% with variable %}...{% endwith %}` |
103+
104+
### 🔧 Jinja2-Specific Snippets
105+
*For Flask, FastAPI, and other Jinja2 projects*
106+
107+
| Prefix | Description | Output |
108+
|--------|-------------|---------|
109+
| `ptj-url` | Static file URL | `{{ url_for('static', filename='file.css') }}` |
110+
| `ptj-mac` | Macro definition | `{% macro name %}...{% endmacro %}` |
111+
| `ptj-com` | Comment | `{# comment #}` |
112+
| `ptj-set` | Set variable | `{% set var = value %}` |
113+
114+
### 🎨 Django-Specific Snippets
115+
*For Django projects*
116+
117+
| Prefix | Description | Output |
118+
|--------|-------------|---------|
119+
| `ptd-url` | URL tag | `{% url 'view-name' args %}` |
120+
| `ptd-load` | Load tag library | `{% load static %}` |
121+
| `ptd-stat` | Static file | `{% static 'path/to/file' %}` |
122+
| `ptd-inc` | Include template | `{% include 'template.html' %}` |
123+
| `ptd-firstof` | First of variables | `{% firstof var1 var2 %}` |
124+
125+
---
126+
127+
## 💻 Usage Examples
128+
129+
### Creating a New Template
130+
131+
Type `ptnew` and press Tab:
132+
133+
```html
134+
{% extends 'base.html' %}
135+
136+
{% block content %}
137+
<!-- Your cursor starts here -->
138+
{% endblock content %}
12139

13-
If installing this extension directly from the repo, copy it into your local `<user home>/.vscode/extensions` folder and restart VS Code.
140+
{% block scripts %}
141+
{% endblock scripts %}
142+
```
14143

15-
Works best with `editor.tabCompletion` enabled (`on`) in your VS Code `Settings`.
144+
### Adding a For Loop
16145

17-
## Usage
146+
Type `ptfor` and press Tab:
18147

19-
Simply type `pt` to start using any of the snippets. The full documentation is below.
148+
```html
149+
{% for item in items %}
150+
<!-- Your cursor starts here -->
151+
{% endfor %}
152+
```
20153

21-
This extension works best with `editor.tabCompletion` enabled (`on`) in your VS Code `Settings`.
154+
Then tab through: `item``items` → loop body
22155

23-
## Changelog
156+
### Django Static File
24157

25-
The full changelog can be found [here](CHANGELOG.md).
158+
Type `ptd-stat` and press Tab:
26159

27-
## Documentation
160+
```html
161+
{% static 'css/style.css' %}
162+
```
28163

29-
See the tables below for general, jinja, django snippets. The `*` denotes where the cursor will start so you can start typing your variables etc. straight the way without wasting key strokes! A `*2` denotes the second position upon hitting the `tab` key again.
164+
---
30165

31-
### General Snippets
166+
## 🤝 Contributing
32167

33-
Prefix | Output
34-
-------|-------
35-
ptnew | Creates a simple base template for any Jinja/Django HTML file
36-
ptvar | {{ `*` }}
37-
ptfilt | {{ `* | *2` }}
38-
ptcode | {% `*` %}
39-
ptblock | {% block `*` %} {% endblock `*` %}
40-
ptext | {% extends ' `*` ' %}
41-
ptsup | {{ `super()` }}
42-
ptfor | Adds a `for` loop block
43-
ptif | Adds an `if` statement block
44-
ptifel | Adds an `if/else` statement block
45-
ptelif | Adds an `if/elif/else` statement block
46-
ptwith | Adds a `with` statement block
168+
Found a bug? Want a new snippet? Contributions are welcome!
47169

48-
### Jinja Specific Snippets
170+
1. **Report Issues**: [Open an issue](https://github.com/EndlessTrax/python-template-snippets/issues)
171+
2. **Request Features**: Have an idea? Share it!
172+
3. **Submit PRs**: Fork, code, and submit a pull request
49173

50-
Prefix | Output
51-
-------|-------
52-
ptj-url | {{ url_for('static', filename=' `*` ') }}
53-
ptj-mac | {% macro `*` %} {% endmacro %}
54-
ptj-com | {# `*` #}
55-
ptj-set | {% set `*` = `*2` %}
174+
### Suggesting New Snippets
56175

57-
### Django Specific Snippets
176+
When requesting a new snippet, please include:
177+
- The template syntax you want added
178+
- Which framework it's for (Jinja2/Django/both)
179+
- A brief description of what it does
58180

59-
Prefix | Output
60-
-------|-------
61-
ptd-url | {% url ' `*` ' `*2` %}
62-
ptd-load | {% load `*` %}
63-
ptd-stat | {% static ' `*` ' %}
64-
ptd-inc | {% include ' `*` ' %}
65-
ptd-firstof | {% firstof `*` `*2` %}
181+
---
66182

67-
## Release Notes
183+
## 📝 Changelog
68184

69-
See the [Changelog](https://github.com/EndlessTrax/python-template-snippets/blob/master/CHANGELOG.md)
185+
See [CHANGELOG.md](CHANGELOG.md) for a detailed version history.
70186

71187
---
72188

73-
This snippet was authored by [Ricky White](https://twitter.com/endlesstrax), and is an open-source extension. Please help to improve this by [submitting issues here](https://github.com/EndlessTrax/python-template-snippets/issues).
189+
## 💖 Support This Project
190+
191+
This extension is free and open source. If you find it helpful, consider:
192+
193+
-[Starring the repo](https://github.com/EndlessTrax/python-template-snippets)
194+
- 💰 [Sponsoring on GitHub](https://github.com/sponsors/EndlessTrax)
195+
- 🐦 [Sharing on social media](https://twitter.com/intent/tweet?text=Check%20out%20Python%20Template%20Snippets%20for%20VS%20Code!&url=https://github.com/EndlessTrax/python-template-snippets)
196+
- 📝 [Writing a review](https://marketplace.visualstudio.com/items?itemName=RickyWhite.python-template-snippets&ssr=false#review-details)
197+
198+
---
199+
200+
## 📜 License
201+
202+
MIT © [Ricky White](https://github.com/EndlessTrax)
203+
204+
---
205+
206+
## 🙏 Acknowledgments
207+
208+
Created and maintained by [Ricky White](https://twitter.com/endlesstrax)
209+
210+
Special thanks to all [contributors](https://github.com/EndlessTrax/python-template-snippets/graphs/contributors) who have helped improve this extension!
211+
212+
---
213+
214+
<div align="center">
215+
216+
**Happy Coding! 🎉**
74217

75-
If you'd like to sponsor the developwment of this extension, please consider [sponsoring me on GitHub](https://github.com/sponsors/EndlessTrax)
218+
Made with ❤️ for the Python community
76219

77-
**Happy Coding!**
220+
</div>

0 commit comments

Comments
 (0)