markdown_titles_to_svg 0.1.9 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +8 -0
- data/README.md +163 -92
- data/lib/markdown_titles_to_svg/version.rb +1 -1
- data/lib/markdown_titles_to_svg.rb +15 -7
- data/markdown_titles_to_svg.gemspec +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca2106bab5022b684ffaaf3ffaa87439007f0dc4c897faec94ba3b88f74b6fd6
|
4
|
+
data.tar.gz: 1f68164069a546ed5e7174836bb81b521ef5732c8b1c2150a328c23e60d82b5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d16163eac72cb0355652a81a5a87b6412e3db9c15e718b90320abf537f4816bb8da87dd874b7bed158400d7be7d746f0df26fe23164ca655df40f0bf4f2a3527
|
7
|
+
data.tar.gz: 0d4961f993b27344c19067a2c8bebc751d807169e268ec1252909ea366659a42331678fc3539d0ed23d067fbb2aaf718f279b82a5800fabcaa6effbe702a5251
|
data/README.md
CHANGED
@@ -1,104 +1,136 @@
|
|
1
|
-
<
|
1
|
+
<a href="#table-of-contents">
|
2
|
+
<img src="https://raw.githubusercontent.com/a6b8/a6b8/main/assets/headlines/custom/markdown-titles-to-.svg-for-ruby.svg" height="45px" alt="Markdown Titles to .svg for Ruby." name="# Markdown Titles to .SVG For Ruby">
|
3
|
+
</a>
|
2
4
|
|
3
5
|
Headline Generator for ```Github Markdown``` File to generate beautiful ```Google Fonts``` Headlines.
|
6
|
+
|
4
7
|
<br>
|
5
|
-
<br>
|
6
|
-
<br>
|
7
|
-
<img src="https://raw.githubusercontent.com/a6b8/a6b8/main/docs/markdown-titles-to-svg-for-ruby/readme/headlines/examples.svg" height="55px" alt="Examples">
|
8
8
|
|
9
|
-
<
|
9
|
+
<a href="#table-of-contents">
|
10
|
+
<img src="https://raw.githubusercontent.com/a6b8/a6b8/main/assets/headlines/default/examples.svg" height="45px" alt="Examples" name="examples">
|
11
|
+
</a>
|
12
|
+
|
13
|
+
<br>
|
14
|
+
<a href="#examples">
|
15
|
+
<img src="https://raw.githubusercontent.com/a6b8/a6b8/main/assets/additional/markdown-titles-to-svg-for-ruby/examples/20.svg" height="38px">
|
16
|
+
</a>
|
10
17
|
|
11
18
|
```ruby
|
12
|
-
|
19
|
+
{ font__google_fonts__h1__name: "Permanent Marker" }
|
13
20
|
```
|
14
21
|
|
15
|
-
<
|
22
|
+
<a href="#examples">
|
23
|
+
<img src="https://raw.githubusercontent.com/a6b8/a6b8/main/assets/additional/markdown-titles-to-svg-for-ruby/examples/21.svg" height="38px">
|
24
|
+
</a>
|
16
25
|
|
17
26
|
```ruby
|
18
|
-
|
27
|
+
{ font__google_fonts__h1__name: "Playfair Display" }
|
19
28
|
```
|
20
29
|
|
21
|
-
<
|
30
|
+
<a href="#examples">
|
31
|
+
<img src="https://raw.githubusercontent.com/a6b8/a6b8/main/assets/additional/markdown-titles-to-svg-for-ruby/examples/22.svg" height="38px">
|
32
|
+
</a>
|
22
33
|
|
23
34
|
```ruby
|
24
|
-
|
35
|
+
{ font__google_fonts__h1__name: "Roboto Condensed" }
|
25
36
|
```
|
26
37
|
|
27
|
-
<
|
38
|
+
<a href="#examples">
|
39
|
+
<img src="https://raw.githubusercontent.com/a6b8/a6b8/main/assets/additional/markdown-titles-to-svg-for-ruby/examples/23.svg" height="38px">
|
40
|
+
</a>
|
28
41
|
|
29
42
|
```ruby
|
30
|
-
|
43
|
+
{ font__google_fonts__h1__name: "Sarina" }
|
31
44
|
```
|
32
45
|
|
33
|
-
<
|
46
|
+
<a href="#examples">
|
47
|
+
<img src="https://raw.githubusercontent.com/a6b8/a6b8/main/assets/additional/markdown-titles-to-svg-for-ruby/examples/24.svg" height="38px">
|
48
|
+
</a>
|
34
49
|
|
35
50
|
```ruby
|
36
|
-
|
51
|
+
{ font__google_fonts__h1__name: "Sonsie One" }
|
37
52
|
```
|
38
53
|
|
39
|
-
<
|
54
|
+
<a href="#examples">
|
55
|
+
<img src="https://raw.githubusercontent.com/a6b8/a6b8/main/assets/additional/markdown-titles-to-svg-for-ruby/examples/25.svg" height="38px">
|
56
|
+
</a>
|
40
57
|
|
41
58
|
```ruby
|
42
|
-
|
59
|
+
{ font__google_fonts__h1__name: "Trocchi" }
|
43
60
|
```
|
44
61
|
|
45
|
-
<
|
62
|
+
<a href="#examples">
|
63
|
+
<img src="https://raw.githubusercontent.com/a6b8/a6b8/main/assets/additional/markdown-titles-to-svg-for-ruby/examples/26.svg" height="38px">
|
64
|
+
</a>
|
46
65
|
|
47
66
|
```ruby
|
48
|
-
|
67
|
+
{ font__google_fonts__h1__name: "UnifrakturMaguntia" }
|
49
68
|
```
|
50
|
-
|
51
|
-
<img src="https://raw.githubusercontent.com/a6b8/a6b8/main/
|
69
|
+
<a href="#examples">
|
70
|
+
<img src="https://raw.githubusercontent.com/a6b8/a6b8/main/assets/additional/markdown-titles-to-svg-for-ruby/examples/27.svg" height="38px">
|
71
|
+
</a>
|
52
72
|
|
53
73
|
```ruby
|
54
|
-
|
74
|
+
{ font__google_fonts__h1__name: "Zilla Slab Highlight" }
|
55
75
|
```
|
76
|
+
|
56
77
|
<br>
|
57
|
-
<br>
|
58
|
-
<img src="https://raw.githubusercontent.com/a6b8/a6b8/main/docs/markdown-titles-to-svg-for-ruby/readme/headlines/quickstart.svg" height="55px" alt="Quickstart">
|
59
78
|
|
60
|
-
|
61
|
-
|
62
|
-
|
79
|
+
<a href="#headline">
|
80
|
+
<img src="https://raw.githubusercontent.com/a6b8/a6b8/main/assets/headlines/default/table-of-contents.svg" height="45px" alt="Table of Contents" name="table-of-contents">
|
81
|
+
</a>
|
82
|
+
|
83
|
+
1. [Examples](#examples)<br>
|
84
|
+
2. [Quickstart](#quickstart)<br>
|
85
|
+
3. [Demo](#demo)<br>
|
86
|
+
4. [Setup](#setup)<br>
|
87
|
+
5. [Process](#process)<br>
|
88
|
+
6. [Functions](#functions)<br>
|
89
|
+
7. [Options](#options)<br>
|
90
|
+
8. [Limitations](#limitations)<br>
|
91
|
+
9. [Contributing](#contributing)<br>
|
92
|
+
10. [License](#license)<br>
|
93
|
+
11. [Code of Conduct](#code-of-conduct)<br>
|
94
|
+
12. [Support my Work](#support-my-work)<br>
|
63
95
|
|
64
|
-
|
65
|
-
'headline',
|
66
|
-
:h1,
|
67
|
-
{}
|
68
|
-
)
|
69
|
-
```
|
96
|
+
<br>
|
70
97
|
|
98
|
+
<a href="#table-of-contents">
|
99
|
+
<img src="https://raw.githubusercontent.com/a6b8/a6b8/main/assets/headlines/default/quickstart.svg" height="45px" alt="Quickstart" name="quickstart">
|
100
|
+
</a>
|
71
101
|
|
72
|
-
|
102
|
+
**Single Title**
|
73
103
|
```ruby
|
74
|
-
|
75
|
-
|
76
|
-
markdowns = [
|
77
|
-
'https://raw.githubusercontent.com/a6b8/a6b8/main/templates/readme.md'
|
78
|
-
]
|
104
|
+
require 'markdown_titles_to_svg'
|
79
105
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
106
|
+
svg = MarkdownTitlesToSvg.single(
|
107
|
+
'headline',
|
108
|
+
:h1,
|
109
|
+
{}
|
110
|
+
)
|
85
111
|
```
|
86
|
-
<br>
|
87
|
-
<br>
|
88
|
-
<img src="https://raw.githubusercontent.com/a6b8/a6b8/main/docs/markdown-titles-to-svg-for-ruby/readme/headlines/demo.svg" height="55px" alt="Demo">
|
89
|
-
|
90
|
-
**A. Implementation**
|
91
|
-
> https://raw.githubusercontent.com/a6b8/a6b8/main/README.md
|
92
112
|
|
93
113
|
|
94
|
-
**
|
95
|
-
|
114
|
+
**Generate from Github Markdown**
|
115
|
+
```ruby
|
116
|
+
require 'markdown_titles_to_svg'
|
96
117
|
|
118
|
+
markdowns = [
|
119
|
+
'https://raw.githubusercontent.com/a6b8/a6b8/main/templates/readme.md'
|
120
|
+
]
|
97
121
|
|
122
|
+
MarkdownTitlesToSvg.generate(
|
123
|
+
markdowns,
|
124
|
+
'a6b8',
|
125
|
+
{}
|
126
|
+
)
|
127
|
+
```
|
98
128
|
|
99
129
|
<br>
|
100
|
-
|
101
|
-
<
|
130
|
+
|
131
|
+
<a href="#table-of-contents">
|
132
|
+
<img src="https://raw.githubusercontent.com/a6b8/a6b8/main/assets/headlines/default/setup.svg" height="45px" alt="Setup" name="setup">
|
133
|
+
</a>
|
102
134
|
|
103
135
|
Add this line to your application's Gemfile:
|
104
136
|
|
@@ -115,19 +147,36 @@ Or install it yourself as:
|
|
115
147
|
$ gem install markdown_headlines_to_svg
|
116
148
|
|
117
149
|
![](https://ruby-gem-downloads-badge.herokuapp.com/markdown_titles_to_svg?type=total&color=lightgray)
|
150
|
+
|
151
|
+
<br>
|
152
|
+
|
118
153
|
<br>
|
154
|
+
|
155
|
+
<a href="#table-of-contents">
|
156
|
+
<img src="https://raw.githubusercontent.com/a6b8/a6b8/main/assets/headlines/default/demo.svg" height="45px" alt="Demo" name="demo">
|
157
|
+
</a>
|
158
|
+
|
159
|
+
**A. Implementation**
|
160
|
+
> https://raw.githubusercontent.com/a6b8/a6b8/main/README.md
|
161
|
+
|
162
|
+
|
163
|
+
**B. Execution**
|
164
|
+
> https://github.com/a6b8/a6b8/blob/main/titles.sh
|
165
|
+
|
119
166
|
<br>
|
120
|
-
|
167
|
+
|
168
|
+
<a href="#table-of-contents">
|
169
|
+
<img src="https://raw.githubusercontent.com/a6b8/a6b8/main/assets/headlines/default/process.svg" height="45px" alt="Process" name="process">
|
170
|
+
</a>
|
121
171
|
|
122
172
|
1. Run Command
|
123
173
|
```txt
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
174
|
+
mds = [ PATH_FILE1, PATH_FILE2 ]
|
175
|
+
markdown_headlines_to_svg.generate(
|
176
|
+
mds,
|
177
|
+
"github_profile_name",
|
178
|
+
options = {}
|
179
|
+
)
|
131
180
|
```
|
132
181
|
|
133
182
|
2. Prepare (Import) Font
|
@@ -175,26 +224,29 @@ Or install it yourself as:
|
|
175
224
|
{ ...
|
176
225
|
|
177
226
|
```
|
227
|
+
|
178
228
|
<br>
|
179
|
-
|
180
|
-
<
|
229
|
+
|
230
|
+
<a href="#table-of-contents">
|
231
|
+
<img src="https://raw.githubusercontent.com/a6b8/a6b8/main/assets/headlines/default/functions.svg" height="45px" alt="Functions" name="functions">
|
232
|
+
</a>
|
181
233
|
|
182
234
|
### .get_options()
|
183
235
|
Output all Parameter
|
184
236
|
```ruby
|
185
|
-
|
237
|
+
MarkdownTitlesToSvg.get_options()
|
186
238
|
|
187
|
-
|
239
|
+
# => { github: { profile: nil, ...
|
188
240
|
```
|
189
241
|
|
190
242
|
### .generate( [], '', {} )
|
191
243
|
Generate and store of Titles in all Files
|
192
244
|
```ruby
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
245
|
+
MarkdownTitlesToSvg.generate(
|
246
|
+
markdowns,
|
247
|
+
'a6b8',
|
248
|
+
{}
|
249
|
+
)
|
198
250
|
```
|
199
251
|
|
200
252
|
| **Type** | **Required** | **Description** | **Example** | **Description** |
|
@@ -206,13 +258,13 @@ Generate and store of Titles in all Files
|
|
206
258
|
### .single( [], '', {} )
|
207
259
|
Generate a single Title and outputs a svg string.
|
208
260
|
```ruby
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
261
|
+
svg = MarkdownTitlesToSvg.single(
|
262
|
+
'headline',
|
263
|
+
:h1,
|
264
|
+
{}
|
265
|
+
)
|
214
266
|
|
215
|
-
|
267
|
+
# => <svg ...
|
216
268
|
```
|
217
269
|
|
218
270
|
| **Type** | **Required** | **Description** | **Example** | **Description** |
|
@@ -222,7 +274,10 @@ Generate a single Title and outputs a svg string.
|
|
222
274
|
| **options** | ```Hash``` | No | ```{}``` | Change default options, see "options" for more Information. |
|
223
275
|
|
224
276
|
<br>
|
225
|
-
|
277
|
+
|
278
|
+
<a href="#table-of-contents">
|
279
|
+
<img src="https://raw.githubusercontent.com/a6b8/a6b8/main/assets/headlines/default/options.svg" height="45px" alt="Options" name="options">
|
280
|
+
</a>
|
226
281
|
|
227
282
|
### Github
|
228
283
|
| Nr | Name | Key | Default | Type | Description |
|
@@ -297,32 +352,48 @@ You can find more Information about ```svg``` format here: https://developer.moz
|
|
297
352
|
| E.1. | Silent | :silent | `false` | Boolean | Controll console output. |
|
298
353
|
|
299
354
|
<br>
|
355
|
+
|
356
|
+
<a href="#table-of-contents">
|
357
|
+
<img src="https://raw.githubusercontent.com/a6b8/a6b8/main/assets/headlines/default/contributing.svg" height="45px" alt="Contributing" name="contributing">
|
358
|
+
</a>
|
359
|
+
|
360
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/a6b8/markdown-titles-to-svg-for-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/a6b8/statosio/blob/master/CODE_OF_CONDUCT.md).
|
361
|
+
|
300
362
|
<br>
|
301
|
-
|
363
|
+
|
364
|
+
<a href="#table-of-contents">
|
365
|
+
<img src="https://raw.githubusercontent.com/a6b8/a6b8/main/assets/headlines/default/limitations.svg" height="45px" alt="Limitations" name="limitations">
|
366
|
+
</a>
|
302
367
|
|
303
368
|
- Font Types are limited to '.ttf' and '.otf'.
|
304
369
|
- Read only Markdown Files from Github.
|
305
|
-
|
370
|
+
|
306
371
|
<br>
|
307
372
|
|
308
|
-
<
|
373
|
+
<a href="#table-of-contents">
|
374
|
+
<img src="https://raw.githubusercontent.com/a6b8/a6b8/main/assets/headlines/default/credits.svg" height="45px" name="credits" alt="Credits">
|
375
|
+
</a>
|
309
376
|
|
310
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/a6b8/statosio-for-wordpress. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/a6b8/statosio/blob/master/CODE_OF_CONDUCT.md).
|
311
|
-
<br>
|
312
|
-
<br>
|
313
377
|
<br>
|
314
|
-
|
378
|
+
|
379
|
+
<a href="#table-of-contents">
|
380
|
+
<img src="https://raw.githubusercontent.com/a6b8/a6b8/main/assets/headlines/default/license.svg" height="45px" alt="License" name="license">
|
381
|
+
</a>
|
315
382
|
|
316
383
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
384
|
+
|
317
385
|
<br>
|
318
|
-
|
319
|
-
<
|
320
|
-
<img src="https://raw.githubusercontent.com/a6b8/a6b8/main/
|
386
|
+
|
387
|
+
<a href="#table-of-contents">
|
388
|
+
<img src="https://raw.githubusercontent.com/a6b8/a6b8/main/assets/headlines/default/code-of-conduct.svg" height="45px" alt="Code of Conduct" name="code-of-conduct">
|
389
|
+
</a>
|
321
390
|
|
322
391
|
Everyone interacting in the Statosio project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/a6b8/markdown-titles-to-svg-for-ruby/blob/master/CODE_OF_CONDUCT.md).
|
392
|
+
|
323
393
|
<br>
|
324
|
-
|
325
|
-
<
|
326
|
-
<img src="https://raw.githubusercontent.com/a6b8/a6b8/main/
|
327
|
-
|
328
|
-
|
394
|
+
|
395
|
+
<a href="#table-of-contents">
|
396
|
+
<img href="#table-of-contents" src="https://raw.githubusercontent.com/a6b8/a6b8/main/assets/headlines/default/star-us.svg" height="45px" name="star-us" alt="Star us">
|
397
|
+
</a>
|
398
|
+
|
399
|
+
Please ⭐️ star this Project, every ⭐️ star makes us very happy!
|
@@ -14,6 +14,9 @@ module MarkdownTitlesToSvg
|
|
14
14
|
class Error < StandardError; end
|
15
15
|
|
16
16
|
@TEMPLATE= {
|
17
|
+
webfonts: {
|
18
|
+
url: 'https://gwfh.mranftl.com/api/fonts' #'https://google-webfonts-helper.herokuapp.com',
|
19
|
+
},
|
17
20
|
github: {
|
18
21
|
profile: nil,
|
19
22
|
source: 'https://raw.githubusercontent.com/'
|
@@ -163,6 +166,7 @@ module MarkdownTitlesToSvg
|
|
163
166
|
when :google_fonts
|
164
167
|
obj[:font][:current][ types[ index ] ] = "./#{types[ index ].to_s}-#{Time.now.getutc.to_i}.ttf"
|
165
168
|
self.google_font_download(
|
169
|
+
obj[:webfonts][:url],
|
166
170
|
obj[:font][:google_fonts][ types[ index ] ][:name],
|
167
171
|
obj[:font][:google_fonts][ types[ index ] ][:variant],
|
168
172
|
obj[:font][:google_fonts][ types[ index ] ][:subset],
|
@@ -191,7 +195,7 @@ module MarkdownTitlesToSvg
|
|
191
195
|
end
|
192
196
|
|
193
197
|
|
194
|
-
def self.google_font_download( font, style, subset, file_name, type, silent )
|
198
|
+
def self.google_font_download( server_url, font, style, subset, file_name, type, silent )
|
195
199
|
def self.unzip_file( file, destination, file_name )
|
196
200
|
Zip::ZipFile.open( file ) do | zip_file |
|
197
201
|
zip_file.each do | f |
|
@@ -203,9 +207,9 @@ module MarkdownTitlesToSvg
|
|
203
207
|
end
|
204
208
|
|
205
209
|
|
206
|
-
server =
|
207
|
-
url = "#{server}/api/fonts"
|
208
|
-
uri = URI(
|
210
|
+
#server = server_url
|
211
|
+
#url = "#{server}/api/fonts"
|
212
|
+
uri = URI( server_url )
|
209
213
|
response = Net::HTTP.get( uri )
|
210
214
|
fonts_all = JSON.parse( response )
|
211
215
|
|
@@ -225,9 +229,13 @@ module MarkdownTitlesToSvg
|
|
225
229
|
!silent ? print( "#{font["id"]} #{variant[:name]} #{subset} (Google Fonts)" ) : ''
|
226
230
|
|
227
231
|
url = ''
|
228
|
-
url +=
|
229
|
-
url += "
|
230
|
-
|
232
|
+
url += "#{server_url}/"
|
233
|
+
url += "#{id[:name]}"
|
234
|
+
url += "?download=zip"
|
235
|
+
url += "&subsets=#{subset}"
|
236
|
+
url += "&formats=ttf"
|
237
|
+
url += "&variants=#{variant[:name]}"
|
238
|
+
|
231
239
|
uri = URI( url )
|
232
240
|
response = Net::HTTP.get( uri )
|
233
241
|
|
@@ -6,7 +6,7 @@ Gem::Specification.new do |spec|
|
|
6
6
|
spec.name = "markdown_titles_to_svg"
|
7
7
|
spec.version = MarkdownTitlesToSvg::VERSION
|
8
8
|
spec.authors = ["a6b8"]
|
9
|
-
spec.email = ["hello@
|
9
|
+
spec.email = ["hello@13plus4.com"]
|
10
10
|
|
11
11
|
spec.summary = "Generate Headlines for (multiple) Github Markdown Pages"
|
12
12
|
spec.description = "Generate beautiful Headlines with Google Fonts for (multiple) Github Markdown Pages."
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: markdown_titles_to_svg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- a6b8
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: text2svg
|
@@ -83,11 +83,12 @@ dependencies:
|
|
83
83
|
description: Generate beautiful Headlines with Google Fonts for (multiple) Github
|
84
84
|
Markdown Pages.
|
85
85
|
email:
|
86
|
-
- hello@
|
86
|
+
- hello@13plus4.com
|
87
87
|
executables: []
|
88
88
|
extensions: []
|
89
89
|
extra_rdoc_files: []
|
90
90
|
files:
|
91
|
+
- ".circleci/config.yml"
|
91
92
|
- ".gitignore"
|
92
93
|
- ".rubocop.yml"
|
93
94
|
- CHANGELOG.md
|