aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--README.md31
-rw-r--r--assets/layout-example1.pngbin0 -> 152853 bytes
-rw-r--r--assets/structure_1.jpgbin65104 -> 62747 bytes
-rw-r--r--src/css/dumbymap.css5
4 files changed, 29 insertions, 7 deletions
diff --git a/README.md b/README.md
index 8fec281..1a46a05 100644
--- a/README.md
+++ b/README.md
@@ -2,6 +2,9 @@
2 2
3This library generate web maps from Semantic HTML, play around with [demo page](https://outdoorsafetylab.github.io/dumbymap/) 3This library generate web maps from Semantic HTML, play around with [demo page](https://outdoorsafetylab.github.io/dumbymap/)
4 4
5> [!CAUTION]
6> API of DumbyMap is not stable now, use it carefully
7
5## Getting Started 8## Getting Started
6 9
7Node.js: 10Node.js:
@@ -20,12 +23,13 @@ document.body.append(container)
20markdown2HTML(container, '# Heading\n\n```map\nid: foo\nuse: Maplibre\n```\n') 23markdown2HTML(container, '# Heading\n\n```map\nid: foo\nuse: Maplibre\n```\n')
21 24
22// Gernerate maps from code block 25// Gernerate maps from code block
23const dumbymap = generateMaps(container) 26const dumbymap = generateMaps(container, options ?? {})
24``` 27```
25 28
26Browser (CDN): 29Browser (CDN):
27- unpkg: https://unpkg.com/dumbymap@latest/dist/dumbymap.mjs 30- unpkg: https://unpkg.com/dumbymap@latest/dist/dumbymap.mjs
28 31
32
29## Semantic HTML 33## Semantic HTML
30 34
31Dumbymap adds several features by Semantic HTML: 35Dumbymap adds several features by Semantic HTML:
@@ -34,7 +38,7 @@ Dumbymap adds several features by Semantic HTML:
34 38
35Generated from Element fits CSS Selector `:has(.language-map)` 39Generated from Element fits CSS Selector `:has(.language-map)`
36 40
37It generates maps by `textContent` in YAML format, done by [`mapclay`](/outdoorsafetylab/mapclay). 41It generates maps by `textContent` in YAML format, done by [mapclay]
38 42
39For example: 43For example:
40~~~markdown 44~~~markdown
@@ -122,6 +126,13 @@ After `generateMaps()`, the container has the following structure:
122 126
123![structure](./assets/structure_1.jpg) 127![structure](./assets/structure_1.jpg)
124 128
129For each element:
130* `class="Dumby"`: Container of DumbyMap Contents. It uses attribute `data-layout` to switch layout
131* `class="SemanticHtml"`: Container of Semantic HTML
132* `class="Showcase"`: Container of map with `class="focus"`. Some layouts use it to display focused map
133* `class="dumby-block"`: Block contains part of contents of Semantic HTML.
134* `class="mapclay"`: Map generated by [mapclay]
135
125## Layouts 136## Layouts
126 137
127Dumbymap switch layouts by attribute `data-layout` of container. Most of the features are done by pure CSS. 138Dumbymap switch layouts by attribute `data-layout` of container. Most of the features are done by pure CSS.
@@ -130,13 +141,15 @@ You can add custom layout by options `layouts`. For example, the following code
130 141
131```css 142```css
132.Dumby[data-layout='sticky'] { 143.Dumby[data-layout='sticky'] {
144 max-width: 80em;
145
133 .Showcase { 146 .Showcase {
134 display: block; 147 display: block;
135 width: 20vw; 148 width: 20vw;
136 height: 40vh; 149 height: 40vh;
137 position: absolute; 150 position: absolute;
138 right: 0; 151 right: 20px;
139 bottom: 0; 152 bottom: 20px;
140 background: red; 153 background: red;
141 } 154 }
142} 155}
@@ -146,13 +159,19 @@ You can add custom layout by options `layouts`. For example, the following code
146generateMaps(container, { layouts: "sticky" }) 159generateMaps(container, { layouts: "sticky" })
147``` 160```
148 161
162<details><summary>Result:</summary>
163
164![](./assets/layout-example1.png)
165
166</details>
167
149 168
150## Dependencies 169## Dependencies
151 170
152- [leader-line](https://anseki.github.io/leader-line/) 171- [leader-line](https://anseki.github.io/leader-line/)
153- [plain-draggable](https://anseki.github.io/plain-draggable/) 172- [plain-draggable](https://anseki.github.io/plain-draggable/)
154- [markdown-it](https://github.com/markdown-it/markdown-it/) 173- [markdown-it](https://github.com/markdown-it/markdown-it/)
155- [mapclay](https://github.com/outdoorsafetylab/mapclay) 174- [mapclay]
156- [EasyMDE](https://github.com/Ionaru/easy-markdown-editor) 175- [EasyMDE](https://github.com/Ionaru/easy-markdown-editor)
157 176
158 177
@@ -168,3 +187,5 @@ generateMaps(container, { layouts: "sticky" })
168* [obsidian-map-view](https://github.com/esm7/obsidian-map-view) 187* [obsidian-map-view](https://github.com/esm7/obsidian-map-view)
169* [odyssey.js](http://cartodb.github.io/odyssey.js/) 188* [odyssey.js](http://cartodb.github.io/odyssey.js/)
170* [StoryMapJS](https://storymap.knightlab.com/) 189* [StoryMapJS](https://storymap.knightlab.com/)
190
191[mapclay]: https://github.com/outdoorsafetylab/mapclay
diff --git a/assets/layout-example1.png b/assets/layout-example1.png
new file mode 100644
index 0000000..ae9eddc
--- /dev/null
+++ b/assets/layout-example1.png
Binary files differ
diff --git a/assets/structure_1.jpg b/assets/structure_1.jpg
index 03e709d..8c238ca 100644
--- a/assets/structure_1.jpg
+++ b/assets/structure_1.jpg
Binary files differ
diff --git a/src/css/dumbymap.css b/src/css/dumbymap.css
index d31d7e6..10778e8 100644
--- a/src/css/dumbymap.css
+++ b/src/css/dumbymap.css
@@ -783,14 +783,15 @@ a[href^='http']:not(:has(img))::after,
783} 783}
784 784
785.Dumby[data-layout='sticky'] { 785.Dumby[data-layout='sticky'] {
786 max-width: 80em;
786 .Showcase { 787 .Showcase {
787 display: block; 788 display: block;
788 width: 20vw; 789 width: 20vw;
789 height: 40vh; 790 height: 40vh;
790 791
791 position: absolute; 792 position: absolute;
792 right: 0; 793 right: 20px;
793 bottom: 0; 794 bottom: 20px;
794 795
795 background: red; 796 background: red;
796 } 797 }