Skip to content

Commit c921264

Browse files
Martin MahnerMartin Mahner
authored andcommitted
Implement repository icons and refactor TOC CSS
- **Repository Icons**: Add specific icons for GitHub, GitLab, and Bitbucket - Automatically detect provider from URL - Use high-quality SVG icons from Simple Icons - Fallback to generic code icon for other providers - **TOC Styling**: Refactor CSS to use variables - Use `--toc-indent-step` for configurable indentation - Simplify nested list styling with `calc()` - **Changelog**: Update Unreleased section with new features
1 parent ee854dd commit c921264

File tree

3 files changed

+42
-6
lines changed

3 files changed

+42
-6
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@
1313
- Smooth transition animations for menu toggle
1414
- Includes action buttons (theme toggle, repo link) in mobile view
1515
- Maintains clean row layout for desktop view
16+
- **Repository Icons** - Added specific icons for GitHub, GitLab, and Bitbucket
17+
- Automatically detects repository provider from URL
18+
- Falls back to generic code icon for other providers
19+
- Uses high-quality SVG icons from Simple Icons
20+
- **TOC Styling** - Refactored Table of Contents CSS
21+
- Uses CSS variables for indentation (`--toc-indent-step`)
22+
- Simplifies nested list styling with `calc()`
1623
- **Playwright testing infrastructure** for end-to-end template testing
1724
- `playwright/build-test-template.js` - Script to build and test templates with real content
1825
- `playwright/fixtures/` - Sample markdown files for testing

microdocs/templates/default/default.html

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,27 @@ <h1 class="font-heading font-semibold text-lg text-gray-900 dark:text-gray-50 sm
8484
</svg>
8585
</button>
8686

87+
<!-- Repository Link -->
8788
<!-- Repository Link -->
8889
{% if repo_url %}
8990
<a href="{{ repo_url }}" target="_blank" rel="noopener noreferrer" class="text-gray-600 transition-colors dark:text-gray-400 dark:hover:text-gray-50 hover:text-gray-900" title="Repository">
90-
<svg class="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
91-
<path stroke-linecap="round" stroke-linejoin="round" d="M17.25 6.75 22.5 12l-5.25 5.25m-10.5 0L1.5 12l5.25-5.25m7.5-3-4.5 16.5" />
92-
</svg>
91+
{% if 'github.com' in repo_url %}
92+
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true">
93+
<path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12" />
94+
</svg>
95+
{% elif 'gitlab.com' in repo_url %}
96+
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true">
97+
<path d="M23.955 13.587l-1.342-4.12L20.63 2.87a.75.75 0 0 0-1.425 0l-1.983 6.597h-10.44L4.799 2.87a.75.75 0 0 0-1.425 0l-1.983 6.597L.045 13.587a.75.75 0 0 0 .272.837l11.683 8.476 11.683-8.476a.75.75 0 0 0 .272-.837z" />
98+
</svg>
99+
{% elif 'bitbucket.org' in repo_url %}
100+
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true">
101+
<path d="M.778 1.213a.768.768 0 0 0-.768.876l3.263 19.815a1.056 1.056 0 0 0 1.042.884h15.37a1.056 1.056 0 0 0 1.042-.884l3.263-19.815a.768.768 0 0 0-.768-.876H.778zM14.52 15.53H9.48l-1.205-7.06h7.45l-1.205 7.06z" />
102+
</svg>
103+
{% else %}
104+
<svg class="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
105+
<path stroke-linecap="round" stroke-linejoin="round" d="M17.25 6.75 22.5 12l-5.25 5.25m-10.5 0L1.5 12l5.25-5.25m7.5-3-4.5 16.5" />
106+
</svg>
107+
{% endif %}
93108
</a>
94109
{% endif %}
95110
</div>

templates_src/default/default.html

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,23 @@ <h1 class="font-heading font-semibold text-lg text-gray-900 dark:text-gray-50 sm
8787
<!-- Repository Link -->
8888
{% if repo_url %}
8989
<a href="{{ repo_url }}" target="_blank" rel="noopener noreferrer" class="text-gray-600 transition-colors dark:text-gray-400 dark:hover:text-gray-50 hover:text-gray-900" title="Repository">
90-
<svg class="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
91-
<path stroke-linecap="round" stroke-linejoin="round" d="M17.25 6.75 22.5 12l-5.25 5.25m-10.5 0L1.5 12l5.25-5.25m7.5-3-4.5 16.5" />
92-
</svg>
90+
{% if 'github.com' in repo_url %}
91+
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true">
92+
<path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12" />
93+
</svg>
94+
{% elif 'gitlab.com' in repo_url %}
95+
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true">
96+
<path d="M23.955 13.587l-1.342-4.12L20.63 2.87a.75.75 0 0 0-1.425 0l-1.983 6.597h-10.44L4.799 2.87a.75.75 0 0 0-1.425 0l-1.983 6.597L.045 13.587a.75.75 0 0 0 .272.837l11.683 8.476 11.683-8.476a.75.75 0 0 0 .272-.837z" />
97+
</svg>
98+
{% elif 'bitbucket.org' in repo_url %}
99+
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true">
100+
<path d="M.778 1.213a.768.768 0 0 0-.768.876l3.263 19.815a1.056 1.056 0 0 0 1.042.884h15.37a1.056 1.056 0 0 0 1.042-.884l3.263-19.815a.768.768 0 0 0-.768-.876H.778zM14.52 15.53H9.48l-1.205-7.06h7.45l-1.205 7.06z" />
101+
</svg>
102+
{% else %}
103+
<svg class="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
104+
<path stroke-linecap="round" stroke-linejoin="round" d="M17.25 6.75 22.5 12l-5.25 5.25m-10.5 0L1.5 12l5.25-5.25m7.5-3-4.5 16.5" />
105+
</svg>
106+
{% endif %}
93107
</a>
94108
{% endif %}
95109
</div>

0 commit comments

Comments
 (0)