Skip to content

Commit baf0cb2

Browse files
authored
feat(doc): use jolicode theme for readme and documentation (#303)
2 parents 17f0b62 + fbbb9a4 commit baf0cb2

File tree

6 files changed

+537
-4
lines changed

6 files changed

+537
-4
lines changed

README.md

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,44 @@
1-
# AutoMapper
1+
<h1 align="center">
2+
<a href="https://github.com/jolicode/automapper"><img src="https://jolicode.com/media/original/oss/headers/automapper.png" alt="automapper"></a>
3+
<br />
4+
AutoMapper
5+
<br />
6+
<sub><em><h6>A blazing fast Data Mapper for PHP.</h6></em></sub>
7+
</h1>
28

3-
The AutoMapper solves a simple problem: removing all the code you need to map one object to another. A boring code to
9+
<!-- Quelques badges optionnels, cool pour l'open source -->
10+
<div align="center">
11+
12+
[![PHP Version Require](http://poser.pugx.org/jolicode/automapper/require/php)](https://packagist.org/packages/jolicode/automapper)<!-- Attention automapper -->
13+
[![Monthly Downloads](http://poser.pugx.org/jolicode/automapper/d/monthly)](https://packagist.org/packages/jolicode/automapper)
14+
15+
</div>
16+
17+
The AutoMapper solves a simple problem: removing all the code you need to map one object to another. A boring code to
418
write and often replaced by less-performant alternatives like Symfony's Serializer.
19+
520
## Quick Start 🚀
621

22+
1. Install:
23+
724
```shell
825
composer require jolicode/automapper
926
```
1027

28+
2. Use it:
29+
30+
```php
31+
$mapper = AutoMapper::create();
32+
$target = $mapper->map($data, Target::class);
33+
```
34+
1135
You can read more about this library and how to use it on the [documentation](https://jolicode.github.io/automapper/).
36+
1237
## Support
1338

1439
For support, please create an issue on [Github tracker](https://github.com/jolicode/automapper/issues)
40+
41+
<br><br>
42+
<div align="center">
43+
<a href="https://jolicode.com/"><img src="https://jolicode.com/media/original/oss/footer-github.png?v3" alt="JoliCode is sponsoring this project"></a>
44+
</div>

castor.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
use Castor\Attribute\AsTask;
66

77
use function Castor\context;
8+
use function Castor\http_download;
9+
use function Castor\io;
810
use function Castor\PHPQa\php_cs_fixer;
911
use function Castor\PHPQa\phpstan;
1012
use function Castor\run;
@@ -88,6 +90,28 @@ function doc_serve()
8890
run('poetry run mkdocs serve -a localhost:8000');
8991
}
9092

93+
#[AsTask(description: 'Fetch external assets and customize theme', namespace: 'doc')]
94+
function build_assets(): void
95+
{
96+
io()->title('Fetching external assets for MkDocs documentation');
97+
98+
http_download('https://raw.githubusercontent.com/jolicode/oss-theme/refs/heads/main/MkDocs/extra.css', __DIR__ . '/docs/assets/stylesheets/jolicode.css');
99+
http_download('https://raw.githubusercontent.com/jolicode/oss-theme/refs/heads/main/snippet-joli-footer.html', __DIR__ . '/docs/overrides/jolicode-footer.html');
100+
101+
$html = <<<'HTML'
102+
AutoMapper is licensed under
103+
<a href="https://github.com/jolicode/automapper/blob/main/LICENSE" target="_blank" rel="noreferrer noopener" class="jf-link">
104+
MIT license
105+
</a>
106+
HTML;
107+
108+
$footer = file_get_contents(__DIR__ . '/docs/overrides/jolicode-footer.html');
109+
$footer = str_replace('#GITHUB_REPO', 'jolicode/automapper', $footer);
110+
$footer = str_replace('<!-- #SUBTITLE -->', $html, $footer);
111+
112+
file_put_contents(__DIR__ . '/docs/overrides/jolicode-footer.html', $footer);
113+
}
114+
91115
#[AsTask('build-github-pages', namespace: 'doc', description: 'Serve documentation')]
92116
function doc_build_github_pages()
93117
{
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
:root > * {
2+
--md-primary-color: #f7d325;
3+
--md-typeset-a-color: #ea1340;
4+
}
5+
6+
[data-md-color-scheme=slate][data-md-color-primary=black] {
7+
--md-typeset-a-color: var(--md-primary-color);
8+
}
9+
10+
@media screen and (min-width: 76.25em) {
11+
.md-nav--primary {
12+
position: relative;
13+
padding-block: 0.6rem;
14+
border: 1px solid var(--md-default-fg-color--lightest);
15+
border-radius: 0.2rem;
16+
17+
.md-nav__list {
18+
padding-bottom: 0;
19+
}
20+
}
21+
22+
.md-nav,
23+
.md-nav--integrated > .md-nav__list > .md-nav__item--active .md-nav--secondary {
24+
margin-bottom: 0;
25+
}
26+
27+
.md-nav__toggle ~ .md-nav {
28+
grid-template-rows: minmax(0, 0fr);
29+
}
30+
31+
.md-nav__item .md-nav__link--active {
32+
&::before {
33+
content: "";
34+
position: absolute;
35+
left: 0;
36+
width: 0.2rem;
37+
height: 0.8rem;
38+
background-color: var(--md-typeset-a-color);
39+
}
40+
}
41+
42+
.md-nav__item--active > .md-nav__link--active,
43+
.md-nav__item--active > .md-nav__container > .md-nav__link--active {
44+
&::before {
45+
content: none;
46+
}
47+
}
48+
}
49+
50+
.md-typeset {
51+
h1 {
52+
margin-bottom: 0.2em;
53+
color: var(--md-default-fg-color);
54+
font-weight: 400;
55+
}
56+
57+
h2 {
58+
font-weight: 400;
59+
}
60+
61+
a {
62+
text-decoration: underline;
63+
}
64+
65+
blockquote {
66+
color: var(--md-default-fg-color);
67+
border: 1px solid var(--md-default-fg-color--lightest);
68+
69+
[dir=ltr] & {
70+
border-left-color: var(--md-primary-color);
71+
}
72+
73+
[dir=rtl] & {
74+
border-right-color: var(--md-primary-color);
75+
}
76+
77+
p {
78+
margin-block: 0.4em;
79+
}
80+
}
81+
}
82+
83+
[data-md-color-scheme=default] .hljs {
84+
background-color: var(--md-default-fg-color--lightest);
85+
}
86+
87+
/* Hide the existing social footer, ours is better */
88+
.md-footer-meta.md-typeset {
89+
display: none;
90+
}

0 commit comments

Comments
 (0)