├── README.md
├── contributeFiles
├── bridge.png
├── docs
│ ├── config.json
│ ├── guides
│ │ ├── emoji.md
│ │ ├── images.md
│ │ └── text.md
│ └── information
│ │ └── intro.md
└── how_to_play_common.json
├── fileDefinitions
└── markdown.json
├── manifest.json
├── scripts
└── index.js
└── ui
├── Header.vue
└── Main.vue
/README.md:
--------------------------------------------------------------------------------
1 | # Markdown Doc Generator
2 |
3 | An extension for [bridge editor](https://bridge-core.app) which makes creating docs in minecraft easier, by generating json-ui from markdown
4 |
5 | [View extension in bridge](https://nightly.bridge-core.app/?viewExtension=9c5bb3e6-1bc4-4453-9afe-a528e8d6e9d5)
6 |
7 | # Screenshots
8 |
9 | In Bridge | In Minecraft
10 | :-------------------------:|:-------------------------:
11 |  | 
12 |
13 | In Bridge | In Minecraft
14 | :-------------------------:|:-------------------------:
15 |  | 
16 |
17 | # Example pages
18 |
19 | - [Text Formatting](https://github.com/FrederoxDev/Markdown-Docs/blob/main/contributeFiles/docs/guides/text.md)
20 | - [Images](https://github.com/FrederoxDev/Markdown-Docs/blob/main/contributeFiles/docs/guides/images.md)
21 | - [Emojis](https://github.com/FrederoxDev/Markdown-Docs/blob/main/contributeFiles/docs/guides/emoji.md)
22 |
--------------------------------------------------------------------------------
/contributeFiles/bridge.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FrederoxDev/Markdown-Docs/8f1028908b21a4372563e21a9876bf740bce54bb/contributeFiles/bridge.png
--------------------------------------------------------------------------------
/contributeFiles/docs/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "categories": [
3 | {
4 | "title": "Information",
5 | "pages": [
6 | "information/intro"
7 | ]
8 | },
9 | {
10 | "title": "Guides",
11 | "pages": [
12 | "guides/text",
13 | "guides/images",
14 | "guides/emoji"
15 | ]
16 | }
17 | ]
18 | }
--------------------------------------------------------------------------------
/contributeFiles/docs/guides/emoji.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Emojis
3 | ---
4 |
5 | # General Icons:
6 |
7 | :armor: - `:armor:`
8 |
9 | :food: - `:food:`
10 |
11 | :minecoin: - `:minecoin:`
12 |
13 | :token: - `:token:`
14 |
15 | :agent: - `:agent:`
16 |
17 | :immersive_reader: - `:immersive_reader:`
18 |
19 | :craft_toggle_on: - `:craft_toggle_on:`
20 |
21 | :craft_toggle_off: - `:craft_toggle_off:`
22 |
23 |
24 | # Mobile Icons:
25 |
26 | :mobile_jump: - `:mobile_jump:`
27 |
28 | :mobile_crouch: - `:mobile_crouch:`
29 |
30 | :mobile_fly_up: - `:mobile_fly_up:`
31 |
32 | :mobile_fly_down: - `:mobile_fly_down:`
33 |
34 | :mobile_left_arrow: - `:mobile_left_arrow:`
35 |
36 | :mobile_right_arrow: - `:mobile_right_arrow:`
37 |
38 | :mobile_up_arrow: - `:mobile_up_arrow:`
39 |
40 | :mobile_down_arrow: - `:mobile_down_arrow:`
41 |
42 |
43 | # PC Icons:
44 |
45 | :pc_left_click: - `:pc_left_click:`
46 |
47 | :pc_right_click: - `:pc_right_click:`
48 |
49 | :pc_middle_click: - `:pc_middle_click`
50 |
51 |
52 | # Xbox Icons
53 |
54 | :xbox_y: - `:xbox_y:`
55 |
56 | :xbox_b: - `:xbox_b:`
57 |
58 | :xbox_a: - `:xbox_a:`
59 |
60 | :xbox_x: - `:xbox_x:`
61 |
62 | :xbox_back: - `:xbox_back:`
63 |
64 | :xbox_start: - `:xbox_start:`
65 |
66 | :xbox_lb: - `:xbox_lb:`
67 |
68 | :xbox_rb: - `:xbox_rb:`
69 |
70 | :xbox_lt: - `:xbox_lt:`
71 |
72 | :xbox_rt: - `:xbox_rt:`
73 |
74 | :xbox_ls: - `:xbox_ls:`
75 |
76 | :xbox_rs: - `:xbox_rs:`
77 |
78 | :xbox_d_pad_up: - `:xbox_d_pad_up:`
79 |
80 | :xbox_d_pad_right: - `:xbox_d_pad_right:`
81 |
82 | :xbox_d_pad_down: - `:xbox_d_pad_down:`
83 |
84 | :xbox_d_pad_left: - `:xbox_d_pad_left:`
85 |
86 |
87 | # Nintendo Switch
88 |
89 | :switch_x: - `:switch_x:`
90 |
91 | :switch_a: - `:switch_a:`
92 |
93 | :switch_b: - `:switch_b:`
94 |
95 | :switch_y: - `:switch_y:`
96 |
97 | :switch_+: - `:switch_+:`
98 |
99 | :switch_-: - `:switch_-:`
100 |
101 | :switch_l: - `:switch_l:`
102 |
103 | :switch_r: - `:switch_r:`
104 |
105 | :switch_zl: - `:switch_zl:`
106 |
107 | :switch_rl: - `:switch_rl:`
108 |
109 | :switch_l: - `:switch_l:`
110 |
111 | :switch_r: - `:switch_r:`
112 |
113 | :switch_d_pad_up: - `:switch_d_pad_up:`
114 |
115 | :switch_d_pad_right: - `:switch_d_pad_right:`
116 |
117 | :switch_d_pad_down: - `:switch_d_pad_down:`
118 |
119 | :switch_d_pad_left: - `:switch_d_pad_left:`
120 |
121 |
122 | # PS4 / PS5
123 |
124 | :ps_triangle: - `:ps_triangle:`
125 |
126 | :ps_circle: - `:ps_circle:`
127 |
128 | :ps_cross: - `:ps_cross:`
129 |
130 | :ps_square: - `:ps_square:`
131 |
132 | :ps_options: - `:ps_options:`
133 |
134 | :ps_touch_pad: - `:ps_touch_pad:`
135 |
136 | :ps_l1: - `:ps_l1:`
137 |
138 | :ps_r1: - `:ps_r1:`
139 |
140 | :ps_l2: - `:ps_l2:`
141 |
142 | :ps_r2: - `:ps_r2:`
143 |
144 | :ps_l3: - `:ps_l3:`
145 |
146 | :ps_r3: - `:ps_r3:`
147 |
148 | :ps_d_pad_up: - `:ps_d_pad_up:`
149 |
150 | :ps_d_pad_right: - `:ps_d_pad_right:`
151 |
152 | :ps_d_pad_down: - `:ps_d_pad_down:`
153 |
154 | :ps_d_pad_left:- `:ps_d_pad_left:`
155 |
--------------------------------------------------------------------------------
/contributeFiles/docs/guides/images.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Images
3 | ---
4 |
5 | # Images
6 |
7 | 
8 | Images can be inserted using ``
9 |
10 | You do not need to include the file extension.
--------------------------------------------------------------------------------
/contributeFiles/docs/guides/text.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Text Formatting
3 | ---
4 |
5 | # Text Formatting
6 |
7 | ***Bold Italic Text*** - `***Bold Italic Text***`
8 | **Bold Text** - `**Bold Text**`
9 | *Italic Text* - `*Italic Text*`
10 | Ignore formatting - \``**Unformatted Text**`\`.
11 |
--------------------------------------------------------------------------------
/contributeFiles/docs/information/intro.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Markdown Docs
3 | ---
4 |
5 | # Markdown Doc Generator
6 |
7 | This extension is built to quickly and easily generate documentation pages with bridge generator scripts from markdown
8 |
9 | Built by FrederoxDev
--------------------------------------------------------------------------------
/contributeFiles/how_to_play_common.json:
--------------------------------------------------------------------------------
1 | {
2 | "namespace": "how_to_play_common",
3 | "dynamic_dialog_screen@common.base_screen": {
4 | "type": "screen",
5 | "size": [
6 | "100%",
7 | "100%"
8 | ],
9 | "button_mappings": [
10 | {
11 | "from_button_id": "button.menu_cancel",
12 | "to_button_id": "button.menu_exit",
13 | "mapping_type": "global"
14 | },
15 | {
16 | "from_button_id": "button.menu_tab_left",
17 | "to_button_id": "button.menu_tab_left",
18 | "mapping_type": "global",
19 | "scope": "view"
20 | },
21 | {
22 | "from_button_id": "button.menu_tab_right",
23 | "to_button_id": "button.menu_tab_right",
24 | "mapping_type": "global",
25 | "scope": "view"
26 | }
27 | ],
28 | "$screen_content": "how_to_play_common.how_to_play_content"
29 | },
30 | "top_bar": {
31 | "type": "image",
32 | "texture": "textures/ui/StoreTopBar"
33 | },
34 | "button_panel@common_buttons.new_ui_binding_button_label": {
35 | "$anchor|default": "left_middle",
36 | "offset": [
37 | 10,
38 | 0
39 | ]
40 | },
41 | "light_text_button@common_buttons.light_text_button": {
42 | "$button_type_panel": "how_to_play_common.button_panel"
43 | },
44 | "action_button@how_to_play_common.light_text_button": {
45 | "$pressed_button_name|default": "unset_button_name",
46 | "$button_text|default": "unset $button_text",
47 | "size": [
48 | "100%",
49 | 30
50 | ],
51 | "anchor_from": "left_middle",
52 | "anchor_to": "left_middle"
53 | },
54 | "topic_category": {
55 | "type": "panel",
56 | "anchor_from": "top_left",
57 | "anchor_to": "top_left",
58 | "size": [
59 | "100%",
60 | "16px"
61 | ],
62 | "controls": [
63 | {
64 | "category_text": {
65 | "type": "label",
66 | "anchor_from": "bottom_left",
67 | "anchor_to": "bottom_left",
68 | "size": [
69 | "default",
70 | "default"
71 | ],
72 | "max_size": [
73 | "100%",
74 | "100% - 4px"
75 | ],
76 | "offset": [
77 | "0px",
78 | "-3px"
79 | ],
80 | "text": "$category",
81 | "color": "$main_header_text_color"
82 | }
83 | }
84 | ]
85 | },
86 | "toggle_button_control": {
87 | "type": "panel",
88 | "layer": 2,
89 | "controls": [
90 | {
91 | "tab_button_text": {
92 | "type": "label",
93 | "anchor_from": "left_middle",
94 | "anchor_to": "left_middle",
95 | "size": [
96 | "100% - 16px",
97 | "9px"
98 | ],
99 | "offset": [
100 | "20px",
101 | 0
102 | ],
103 | "text": "$section_topic",
104 | "layer": 3,
105 | "color": "$text_color",
106 | "alpha": "$content_alpha"
107 | }
108 | }
109 | ]
110 | },
111 | "section_toggle_button": {
112 | "type": "panel",
113 | "anchor_from": "top_left",
114 | "anchor_to": "top_left",
115 | "size": [
116 | "100%",
117 | "30px"
118 | ],
119 | "controls": [
120 | {
121 | "section_toggle_button@common_toggles.light_ui_toggle": {
122 | "anchor_from": "top_left",
123 | "anchor_to": "top_left",
124 | "size": [
125 | "100%",
126 | "30px"
127 | ],
128 | "$button_type_panel": "how_to_play_common.toggle_button_control",
129 | "$radio_toggle_group": true,
130 | "$toggle_name": "navigation_tab",
131 | "$toggle_group_default_selected": "$default_selector_toggle_index",
132 | "$toggle_tab_focus_binding_type": "global",
133 | "$toggle_tab_focus_binding_name": "#navigation_tab_focus_precedence",
134 | "$toggle_on_hover_binding_type": "global",
135 | "$toggle_on_hover_binding_name": "#toggle_on_hover",
136 | "$toggle_view_binding_name": "($section_topic + '_button_toggle')",
137 | "$toggle_property_bag": {
138 | "#panel_title": "$section_topic"
139 | }
140 | }
141 | }
142 | ]
143 | },
144 | "padding": {
145 | "type": "panel",
146 | "size": [
147 | "100%",
148 | "12px"
149 | ]
150 | },
151 | "large_padding@how_to_play_common.padding": {
152 | "type": "panel",
153 | "size": [
154 | "100%",
155 | "22px"
156 | ]
157 | },
158 | "section_contents_header": {
159 | "type": "input_panel",
160 | "focus_enabled": true,
161 | "size": [
162 | "100%",
163 | "6px"
164 | ]
165 | },
166 | "section_contents_footer": {
167 | "type": "input_panel",
168 | "focus_enabled": true,
169 | "size": [
170 | "100%",
171 | "24px"
172 | ]
173 | },
174 | "main_sections": {
175 | "type": "stack_panel",
176 | "size": [
177 | "100%",
178 | "100%c"
179 | ],
180 | "anchor_from": "top_left",
181 | "anchor_to": "top_left"
182 | },
183 | "splitscreen_only_content": {
184 | "type": "stack_panel",
185 | "size": [
186 | "100%",
187 | "100%c"
188 | ],
189 | "orientation": "vertical",
190 | "controls": "$content",
191 | "bindings": [
192 | {
193 | "binding_name": "#splitscreen_enabled",
194 | "binding_name_override": "#visible"
195 | }
196 | ]
197 | },
198 | "header_background": {
199 | "type": "image",
200 | "size": [
201 | "100%",
202 | "20px"
203 | ],
204 | "offset": [
205 | 0,
206 | "-2px"
207 | ],
208 | "anchor_from": "bottom_middle",
209 | "anchor_to": "bottom_middle",
210 | "texture": "textures/ui/Banners",
211 | "controls": [
212 | {
213 | "header_label": {
214 | "type": "label",
215 | "color": "$body_text_color",
216 | "layer": 1,
217 | "anchor_from": "center",
218 | "anchor_to": "center",
219 | "text_alignment": "center",
220 | "max_size": [
221 | "95%",
222 | 10
223 | ],
224 | "text": "$text"
225 | }
226 | }
227 | ]
228 | },
229 | "header": {
230 | "type": "panel",
231 | "size": [
232 | "100%",
233 | "28px"
234 | ],
235 | "controls": [
236 | {
237 | "header@how_to_play_common.header_background": {}
238 | }
239 | ]
240 | },
241 | "paragraph": {
242 | "type": "label",
243 | "color": "$body_text_color",
244 | "anchor_from": "left_middle",
245 | "anchor_to": "left_middle",
246 | "text_alignment": "$text_alignment",
247 | "size": [
248 | "100%",
249 | "default"
250 | ],
251 | "text": "$text"
252 | },
253 | "paragraph_with_icons@how_to_play_common.paragraph": {
254 | "text": "$text",
255 | "bindings": [
256 | {
257 | "binding_name": "$text"
258 | }
259 | ]
260 | },
261 | "paragraph_with_selective_input@how_to_play_common.paragraph_with_icons": {
262 | "line_padding": 4.0,
263 | "bindings": [
264 | {
265 | "binding_name": "$text"
266 | },
267 | {
268 | "binding_name": "$input_binding",
269 | "binding_name_override": "#visible"
270 | }
271 | ]
272 | },
273 | "paragraph_keyboard@how_to_play_common.paragraph_with_selective_input": {
274 | "$input_binding": "#keyboard_being_used"
275 | },
276 | "paragraph_gamepad@how_to_play_common.paragraph_with_selective_input": {
277 | "line_padding": 10.0,
278 | "$input_binding": "#gamepad_being_used"
279 | },
280 | "paragraph_rift_controller@how_to_play_common.paragraph_with_selective_input": {
281 | "line_padding": 10.0,
282 | "$input_binding": "#rift_controller_being_used"
283 | },
284 | "paragraph_windowsmr_controller@how_to_play_common.paragraph_with_selective_input": {
285 | "line_padding": 10.0,
286 | "$input_binding": "#windowsmr_controller_being_used"
287 | },
288 | "paragraph_touch@how_to_play_common.paragraph_with_selective_input": {
289 | "line_padding": 12.0,
290 | "$input_binding": "#touch_being_used"
291 | },
292 | "paragraph_not_touch@how_to_play_common.paragraph_with_selective_input": {
293 | "line_padding": 10.0,
294 | "$input_binding": "#touch_not_being_used"
295 | },
296 | "image": {
297 | "type": "image",
298 | "layer": 1,
299 | "size": [
300 | "100%",
301 | "128px"
302 | ],
303 | "anchor_from": "center",
304 | "anchor_to": "center"
305 | },
306 | "how_to_play_header": {
307 | "type": "panel",
308 | "controls": [
309 | {
310 | "top_bar@how_to_play_common.top_bar": {
311 | "size": [
312 | "100%",
313 | "100%"
314 | ],
315 | "layer": 2,
316 | "controls": [
317 | {
318 | "back_button@common.back_title_button": {
319 | "anchor_from": "left_middle",
320 | "anchor_to": "left_middle",
321 | "offset": [
322 | 2,
323 | -1
324 | ]
325 | }
326 | },
327 | {
328 | "how_to_play_title@common.screen_header_title_panel": {
329 | "size": [
330 | "70% - 22px",
331 | "100%"
332 | ], // Gamepad helpers have max size of 30% and the back button is 20px
333 | "offset": [
334 | 20,
335 | -1
336 | ],
337 | "anchor_from": "left_middle",
338 | "anchor_to": "left_middle",
339 | "$screen_header_title": "#section_title",
340 | "$screen_header_title_binding_type": "global",
341 | "layer": 2
342 | }
343 | },
344 | {
345 | "gamepad_bumper_helpers@how_to_play_common.gamepad_bumper_helpers": {}
346 | }
347 | ]
348 | }
349 | }
350 | ]
351 | },
352 | "how_to_play_content": {
353 | "type": "panel",
354 | "controls": [
355 | {
356 | "header@how_to_play_common.how_to_play_header": {
357 | "size": [
358 | "100%",
359 | "23px"
360 | ],
361 | "anchor_from": "top_left",
362 | "anchor_to": "top_left"
363 | }
364 | },
365 | {
366 | "container": {
367 | "type": "panel",
368 | "size": "$store_screen_size",
369 | "controls": [
370 | {
371 | "$dialog_content@$dialog_content": {}
372 | }
373 | ]
374 | }
375 | }
376 | ]
377 | },
378 | "dialog_content": {
379 | "type": "panel",
380 | "anchor_from": "top_middle",
381 | "anchor_to": "top_middle",
382 | "controls": [
383 | {
384 | "selector_area@how_to_play_common.selector_area": {}
385 | },
386 | {
387 | "content_area@how_to_play_common.content_area_wrapper": {}
388 | },
389 | {
390 | "section_divider@how_to_play_common.section_divider": {}
391 | }
392 | ]
393 | },
394 | "scrollable_selector_area_content": {
395 | "type": "panel",
396 | "offset": [
397 | "6px",
398 | "2px"
399 | ],
400 | "size": [
401 | "100% - 8px",
402 | "100%c + 4px"
403 | ],
404 | "controls": [
405 | {
406 | "$selector_stack_panel@$selector_stack_panel": {}
407 | }
408 | ]
409 | },
410 | // left side
411 | "selector_area": {
412 | "type": "panel",
413 | "offset": [
414 | "-2px",
415 | "21px"
416 | ],
417 | "size": [
418 | "30% + 2px",
419 | "100% - 19px"
420 | ],
421 | "anchor_from": "top_left",
422 | "anchor_to": "top_left",
423 | "layer": 3,
424 | "focus_container": true,
425 | "use_last_focus": true,
426 | "$focus_nagivation_mode_override_down|default": "contained",
427 | "$focus_nagivation_mode_override_up|default": "contained",
428 | "$focus_nagivation_mode_override_left|default": "",
429 | "$focus_nagivation_mode_override_right|default": "",
430 | "controls": [
431 | {
432 | "scrolling_panel@common.scrolling_panel": {
433 | "$scrolling_content": "how_to_play_common.scrollable_selector_area_content",
434 | "$show_background": false,
435 | "$scroll_size": [
436 | "5px",
437 | "100% - 4px"
438 | ],
439 | "$scroll_bar_left_padding_size": [
440 | 0,
441 | 0
442 | ]
443 | }
444 | }
445 | ]
446 | },
447 | // divider between two sides
448 | "section_divider": {
449 | "type": "image",
450 | "offset": [
451 | "30%",
452 | "20px"
453 | ],
454 | "size": [
455 | "4px",
456 | "100% - 18px"
457 | ],
458 | "anchor_from": "top_left",
459 | "anchor_to": "top_left",
460 | "layer": 3,
461 | "texture": "textures/ui/HowToPlayDivider"
462 | },
463 | // contains right side
464 | "content_area_wrapper": {
465 | "type": "panel",
466 | "offset": [
467 | "2px",
468 | "21px"
469 | ],
470 | "size": [
471 | "70% - 2px",
472 | "100% - 19px"
473 | ],
474 | "anchor_from": "top_right",
475 | "anchor_to": "top_right",
476 | "layer": 1,
477 | "controls": [
478 | {
479 | "content_area@how_to_play_common.content_area": {}
480 | }
481 | ]
482 | },
483 | // right side
484 | "content_area": {
485 | "type": "panel",
486 | "size": [
487 | "100% - 6px",
488 | "100%"
489 | ],
490 | "anchor_from": "top_right",
491 | "anchor_to": "top_right",
492 | "controls": [
493 | {
494 | "control": {
495 | "type": "stack_panel",
496 | "size": [
497 | "100%",
498 | "100%"
499 | ],
500 | "anchor_from": "top_right",
501 | "anchor_to": "top_right",
502 | "controls": [
503 | {
504 | "scrolling_panel@common.scrolling_panel": {
505 | "size": [
506 | "100%",
507 | "fill"
508 | ],
509 | "$scrolling_content": "$section_content_panels",
510 | "$show_background": false,
511 | "$scroll_size": [
512 | "5px",
513 | "100% - 4px"
514 | ],
515 | "$scroll_bar_left_padding_size": [
516 | 5,
517 | 0
518 | ],
519 | "$scroll_bar_right_padding_size": [
520 | 5,
521 | 0
522 | ]
523 | }
524 | }
525 | ]
526 | }
527 | }
528 | ]
529 | },
530 | "screen_base@how_to_play_common.dynamic_dialog_screen": {
531 | "$dialog_content": "how_to_play_common.dialog_content"
532 | },
533 | "gamepad_bumper_helper_description@common.gamepad_helper_icon_description": {
534 | "max_size": [
535 | "54px",
536 | "10px"
537 | ]
538 | },
539 | // gamepad helpers
540 | "gamepad_bumper_helpers": {
541 | "type": "stack_panel",
542 | "orientation": "horizontal",
543 | "anchor_from": "right_middle",
544 | "anchor_to": "right_middle",
545 | "offset": [
546 | "-4px",
547 | "-2px"
548 | ],
549 | "max_size": [
550 | "30%",
551 | "26px"
552 | ],
553 | "layer": 6,
554 | "controls": [
555 | {
556 | "gamepad_helper_left_bumper@common.gamepad_helper_left_bumper": {
557 | "$gamepad_description": "how_to_play_common.gamepad_bumper_helper_description"
558 | }
559 | },
560 | {
561 | "padding": {
562 | "type": "panel",
563 | "size": [
564 | "4px",
565 | "100%"
566 | ]
567 | }
568 | },
569 | {
570 | "gamepad_helper_right_bumper@common.gamepad_helper_right_bumper": {
571 | "$gamepad_description": "how_to_play_common.gamepad_bumper_helper_description"
572 | }
573 | }
574 | ]
575 | }
576 | }
--------------------------------------------------------------------------------
/fileDefinitions/markdown.json:
--------------------------------------------------------------------------------
1 | {
2 | "id": "md",
3 | "type": "text",
4 | "icon": "mdi-book",
5 | "detect": {
6 | "scope": "docs/",
7 | "fileExtensions": [".md"]
8 | },
9 | "formatOnSaveCapable": false
10 | }
--------------------------------------------------------------------------------
/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "api_version": 2,
3 | "author": "Frederox",
4 | "name": "Markdown Docs",
5 | "version": "1.0.0",
6 | "id": "9c5bb3e6-1bc4-4453-9afe-a528e8d6e9d5",
7 | "description": "Easily create documentation ingame",
8 | "tags": [
9 | "Utility",
10 | "Curated"
11 | ],
12 | "target": "v2",
13 | "icon": "mdi-book-open-outline",
14 | "contributeFiles": {
15 | "contributeFiles/docs/guides": {
16 | "path": "docs/guides"
17 | },
18 | "contributeFiles/docs/information": {
19 | "path": "docs/information"
20 | },
21 | "contributeFiles/docs/config.json": {
22 | "path": "docs/config.json"
23 | },
24 | "contributeFiles/bridge.png": {
25 | "pack": "resourcePack",
26 | "path": "textures/bridge.png"
27 | },
28 | "contributeFiles/how_to_play_common.json": {
29 | "pack": "resourcePack",
30 | "path": "ui/how_to_play_common.json"
31 | }
32 | },
33 | "compatibleAppVersions": {
34 | "min": "2.3.2"
35 | },
36 | "readme": "https://github.com/FrederoxDev/Markdown-Docs/blob/main/README.md"
37 | }
--------------------------------------------------------------------------------
/scripts/index.js:
--------------------------------------------------------------------------------
1 | const { create, SidebarContent } = await require("@bridge/sidebar")
2 | const { Main, Header } = await require("@bridge/ui")
3 | const { getDirectoryHandle, getFileHandle, writeJSON } = await require("@bridge/fs")
4 | const { getCurrentProject, resolvePackPath } = await require("@bridge/env")
5 | const { createError } = await require("@bridge/notification")
6 | const { compileFiles } = await require("@bridge/project")
7 |
8 | const icons = {
9 | "armor": "",
10 | "food": "",
11 | "minecoin": "",
12 | "token": "",
13 | "agent": "",
14 | "immersive_reader": "",
15 | "craft_toggle_on": "",
16 | "craft_toggle_off": "",
17 |
18 | "mobile_jump": "",
19 | "mobile_crouch": "",
20 | "mobile_fly_up": "",
21 | "mobile_fly_down": "",
22 | "mobile_left_arrow": "",
23 | "mobile_right_arrow": "",
24 | "mobile_up_arrow": "",
25 | "mobile_down_arrow": "",
26 |
27 | "pc_left_click": "",
28 | "pc_right_click": "",
29 | "pc_middle_click": "",
30 |
31 | "xbox_y": "",
32 | "xbox_b": "",
33 | "xbox_a": "",
34 | "xbox_x": "",
35 | "xbox_back": "",
36 | "xbox_start": "",
37 | "xbox_lb": "",
38 | "xbox_rb": "",
39 | "xbox_lt": "",
40 | "xbox_rt": "",
41 | "xbox_ls": "",
42 | "xbox_rs": "",
43 | "xbox_d_pad_up": "",
44 | "xbox_d_pad_right": "",
45 | "xbox_d_pad_down": "",
46 | "xbox_d_pad_left": "",
47 |
48 | "switch_x": "",
49 | "switch_a": "",
50 | "switch_b": "",
51 | "switch_y": "",
52 | "switch_+": "",
53 | "switch_-": "",
54 | "switch_l": "",
55 | "switch_r": "",
56 | "switch_zl": "",
57 | "switch_rl": "",
58 | "switch_l": "",
59 | "switch_r": "",
60 | "switch_d_pad_up": "",
61 | "switch_d_pad_right": "",
62 | "switch_d_pad_down": "",
63 | "switch_d_pad_left": "",
64 |
65 | "ps_triangle": "",
66 | "ps_circle": "",
67 | "ps_cross": "",
68 | "ps_square": "",
69 | "ps_options": "",
70 | "ps_touch_pad": "",
71 | "ps_l1": "",
72 | "ps_r1": "",
73 | "ps_l2": "",
74 | "ps_r2": "",
75 | "ps_l3": "",
76 | "ps_r3": "",
77 | "ps_d_pad_up": "",
78 | "ps_d_pad_right":"",
79 | "ps_d_pad_down": "",
80 | "ps_d_pad_left": ""
81 | }
82 |
83 | class MarkdownSidebar extends SidebarContent {
84 | component = Main;
85 | directoryHandle = null;
86 | docsPath = getCurrentProject() + "/docs";
87 | headerSlot = Header;
88 |
89 | isGenerating = false
90 |
91 | // Assigns each element with a seperate id.
92 | elementIdCounter = 0;
93 | pageIdCounter = 0;
94 | categoryIdCounter = 0;
95 |
96 | // Json arrays
97 | sections = []
98 | buttons = [
99 | {
100 | "padding_0": {
101 | "type": "panel",
102 | "size": [
103 | 0,
104 | 6
105 | ]
106 | }
107 | }
108 | ]
109 | tips = [
110 | {
111 | "section_contents_header@how_to_play_common.section_contents_header": {}
112 | }
113 | ]
114 |
115 | constructor() {
116 | super()
117 | this.loadHandle();
118 | this.headerHeight = '60px';
119 | }
120 |
121 | async loadHandle() {
122 | this.directoryHandle = await getDirectoryHandle(this.docsPath, { create: true })
123 | }
124 |
125 | async compileDocs() {
126 | this.isGenerating = true
127 | const config = await this.LoadConfig();
128 |
129 | if (config === null) {
130 | this.isGenerating = false;
131 | return;
132 | }
133 |
134 | // Assigns each element with a seperate id.
135 | this.elementIdCounter = 0;
136 | this.pageIdCounter = 0;
137 | this.categoryIdCounter = 0;
138 |
139 | // Json arrays
140 | this.sections = []
141 | this.buttons = [{ "padding_0": { "type": "panel", "size": [0, 6] } }]
142 | this.tips = [{ "section_contents_header@how_to_play_common.section_contents_header": {} }]
143 |
144 | for (var c = 0; c < config.categories.length; c++) {
145 | const title = config.categories[c].title || `Unnamed ${c}`
146 | const pages = config.categories[c].pages
147 |
148 | // Add category titles
149 | this.categoryIdCounter++;
150 |
151 | this.buttons.push({
152 | [`category_${this.categoryIdCounter}@how_to_play_common.topic_category`]: {
153 | "$category": title
154 | }
155 | })
156 |
157 | // Parse each file
158 | for (var p = 0; p < pages?.length; p++) {
159 | await this.ParseFile(pages[p]);
160 | }
161 | }
162 |
163 | await this.SaveOutput();
164 | this.isGenerating = false;
165 | }
166 |
167 | async LoadConfig() {
168 | const configHandle = await getFileHandle(this.docsPath + "/config.json", { create: true })
169 |
170 | try {
171 | return JSON.parse(await (await configHandle.getFile()).text())
172 | }
173 |
174 | catch {
175 | createError(new Error("[Markdown Docs] docs/config.json could not be parsed. You may have invalid JSON."))
176 | return null
177 | }
178 | }
179 |
180 | async ParseFile(fileName) {
181 | const filePath = `${this.docsPath}/${fileName}.md`
182 |
183 | var fileHandle;
184 | var file;
185 |
186 | try {
187 | fileHandle = await getFileHandle(filePath)
188 | file = await (await fileHandle.getFile()).text()
189 | }
190 |
191 | catch {
192 | createError(new Error(`[Markdown Docs] ${filePath} could not be found!`))
193 | return;
194 | }
195 |
196 | var sectionName = "Unnamed"
197 | var yamlStartIdx = file.indexOf("---") + 3;
198 | var yamlEndIdx = file.lastIndexOf("---")
199 |
200 | var yaml = file.substring(yamlStartIdx, yamlEndIdx).replaceAll("\r", "").split("\n")
201 |
202 | yaml.forEach((line) => {
203 | if (yamlStartIdx == -1 || yamlEndIdx == -1) return;
204 | if (line == "") return;
205 |
206 | var key = line.split(": ")[0]
207 | var value = line.split(": ")[1]
208 |
209 | if (key == "name") sectionName = value;
210 | })
211 |
212 | var pageElements = []
213 | file = file.slice(yamlEndIdx + 3).trim()
214 |
215 | const fileContent = file.split("\n")
216 |
217 | fileContent.forEach((line) => {
218 | line = line.replace("\r", "");
219 | line = line + " "
220 |
221 | console.log(line)
222 |
223 | var isCodeBlock = new RegExp(/\`.*\`/m).test(line)
224 |
225 | var chars = line.split("")
226 | var lastChar = ""
227 | var lastLastChar = ""
228 |
229 | var isBoldItalic = false;
230 | var isBold = false;
231 | var isItalic = false;
232 | var isCode = false;
233 | var isEmoji = false;
234 |
235 | var emojiText = ""
236 |
237 | chars.forEach((char, index) => {
238 | // Code blocks
239 | if (char == "`") {
240 | if (lastChar == "\\") {
241 | chars[index - 1] = ""
242 | }
243 |
244 | else if (!isCode) {
245 | chars[index] = ""
246 | isCode = true
247 | }
248 |
249 | else {
250 | chars[index] = ""
251 | isCode = false
252 | }
253 | }
254 |
255 | if (isCode) return;
256 |
257 |
258 | if (char == ":") {
259 | if (!isEmoji) {
260 | isEmoji = true;
261 | chars[index] = ""
262 | return;
263 | }
264 |
265 | else {
266 | var icon = icons[emojiText] || `:${emojiText}:`
267 | chars[index] = icon
268 |
269 | isEmoji = false;
270 | emojiText = ""
271 | }
272 | }
273 |
274 | if (isEmoji) {
275 | emojiText += char;
276 | chars[index] = ""
277 |
278 | return;
279 | }
280 |
281 | // Bold Italic text (***)
282 | if (char == "*" && lastChar == "*" && lastLastChar == "*") {
283 | if (!isBoldItalic) {
284 | chars[index] = "§l§o"
285 | chars[index - 1] = ""
286 | chars[index - 2] = ""
287 | isBoldItalic = true
288 | }
289 |
290 | else {
291 | chars[index] = "§r"
292 | chars[index - 1] = ""
293 | chars[index - 2] = ""
294 | isBoldItalic = false
295 | }
296 | }
297 |
298 | // Bold text (**)
299 | if (char == "*" && lastChar == "*" && lastLastChar != "*") {
300 | if (!isBold) {
301 | chars[index - 1] = ""
302 | chars[index] = "§l"
303 | isBold = true
304 | }
305 |
306 | else {
307 | chars[index - 1] = ""
308 | chars[index] = "§r"
309 | isBold = false;
310 | }
311 | }
312 |
313 | // Italic text (*)
314 | if (char != "*" && lastChar == "*" && lastLastChar != "*") {
315 | if (!isItalic) {
316 | chars[index - 1] = "§o"
317 | isItalic = true
318 | }
319 |
320 | else {
321 | chars[index - 1] = "§r"
322 | isItalic = false
323 | }
324 | }
325 |
326 | lastLastChar = lastChar;
327 | lastChar = char;
328 | })
329 |
330 | line = chars.join("");
331 |
332 | // Images
333 | if (line.match(/!\[.*\]\(.*\)/m) && !isCodeBlock) {
334 | var texturePath = line.split("(").pop().split(")")[0]
335 | var altText = line.split("[").pop().split("]")[0]
336 |
337 | pageElements.push({
338 | [`image_${this.elementIdCounter}@how_to_play_common.image`]: {
339 | "texture": texturePath
340 | }
341 | })
342 |
343 | this.elementIdCounter++;
344 |
345 | if (altText != "") {
346 | console.log("Alt text")
347 | pageElements.push({
348 | [`paragraph_${this.elementIdCounter}@how_to_play_common.paragraph`]: {
349 | "$text": "§7§o" + altText,
350 | "$text_alignment": "center"
351 | }
352 | })
353 |
354 | this.elementIdCounter++;
355 |
356 | pageElements.push({
357 | [`padding_${this.elementIdCounter}@how_to_play_common.padding`]: {}
358 | })
359 | this.elementIdCounter++;
360 | }
361 |
362 | return;
363 | }
364 |
365 | // Padding
366 | if (line == "") {
367 | pageElements.push({
368 | [`padding_${this.elementIdCounter}@how_to_play_common.padding`]: {}
369 | })
370 | this.elementIdCounter++;
371 | return;
372 | }
373 |
374 | // Headers
375 | if (line.startsWith("# ")) {
376 | line = line.replace("# ", "")
377 | pageElements.push({
378 | [`header_${this.elementIdCounter}@how_to_play_common.header`]: {
379 | "$text": line
380 | }
381 | })
382 | this.elementIdCounter++;
383 | return;
384 | }
385 |
386 | // Paragraphs
387 | pageElements.push({
388 | [`paragraph_${this.elementIdCounter}@how_to_play_common.paragraph`]: {
389 | "$text": line,
390 | "$text_alignment": "left"
391 | }
392 | })
393 | this.elementIdCounter++;
394 | })
395 |
396 | this.sections.push({
397 | [`section_${this.pageIdCounter}_button@how_to_play_common.section_toggle_button`]: {
398 | "$section_topic": sectionName
399 | }
400 | })
401 |
402 | this.sections.push({
403 | [`section_${this.pageIdCounter}@how_to_play_common.main_sections`]: {
404 | "bindings": [
405 | {
406 | "binding_type": "view",
407 | "source_control_name": `${sectionName}_button_toggle`,
408 | "source_property_name": "#toggle_state",
409 | "target_property_name": "#visible"
410 | }
411 | ],
412 | "controls": pageElements
413 | }
414 | })
415 |
416 | this.buttons.push({
417 | [`section_${this.pageIdCounter}_button@how_to_play.section_${this.pageIdCounter}_button`]: {
418 | "$toggle_group_forced_index": this.pageIdCounter
419 | }
420 | })
421 |
422 | this.tips.push({
423 | [`section_${this.pageIdCounter}@how_to_play.section_${this.pageIdCounter}`]: {}
424 | })
425 |
426 | this.pageIdCounter++;
427 | }
428 |
429 | async SaveOutput() {
430 | var output = {
431 | "namespace": "how_to_play",
432 | "how_to_play_screen@how_to_play_common.screen_base": {
433 | "$selector_stack_panel": "how_to_play.selector_stack_panel",
434 | "$section_content_panels": "how_to_play.section_content_panels",
435 | "$header_safezone_control": "common_store.store_top_bar_filler",
436 | "$header_bar_control": "common_store.store_top_bar",
437 | "$is_full_screen_layout": true
438 | },
439 | "selector_stack_panel": {
440 | "type": "stack_panel",
441 | "anchor_from": "top_left",
442 | "anchor_to": "top_left",
443 | "orientation": "vertical",
444 | "$default_selector_toggle_index": 0,
445 | "controls": [
446 | {
447 | "how_to_play_selector_pane": {
448 | "type": "stack_panel",
449 | "controls": this.buttons
450 | }
451 | }
452 | ]
453 | },
454 | "section_content_panels": {
455 | "type": "stack_panel",
456 | "anchor_from": "top_left",
457 | "anchor_to": "top_left",
458 | "size": [
459 | "100% - 5px",
460 | "100%c + 5px"
461 | ],
462 | "offset": [
463 | 2,
464 | 0
465 | ],
466 | "controls": [
467 | {
468 | "general_tips_sections": {
469 | "type": "stack_panel",
470 | "controls": this.tips
471 | }
472 | }
473 | ]
474 | }
475 | }
476 |
477 | // Add json objects to output
478 | this.sections.forEach((section) => {
479 | Object.assign(output, section);
480 | })
481 |
482 | await writeJSON(await resolvePackPath('resourcePack', 'ui') + "/how_to_play_screen.json", output, true)
483 | await compileFiles([await resolvePackPath('resourcePack', 'ui') + "/how_to_play_screen.json"])
484 | }
485 | }
486 |
487 | const sidebar = create({
488 | id: 'frederox.markdown_docs',
489 | icon: 'mdi-book-open-outline',
490 | displayName: '[Markdown Docs]',
491 | sidebarContent: new MarkdownSidebar()
492 | })
493 |
--------------------------------------------------------------------------------
/ui/Header.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | mdi-book
6 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/ui/Main.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Compile Docs
5 |
6 |
7 |
8 |
9 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------