From e4f6b7ecd5872d1ec80d3aa961ffa93708291224 Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Fri, 4 Oct 2024 16:01:22 +0800 Subject: docs: update README --- README.md | 129 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 117 insertions(+), 12 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 4bde800..3296bd5 100644 --- a/README.md +++ b/README.md @@ -20,20 +20,124 @@ document.body.append(container) markdown2HTML(container, '# Heading\n\n```map\nid: foo\nuse: Maplibre\n```\n') // Gernerate maps from code block -generateMaps(container) +const dumbymap = generateMaps(container) ``` Browser (CDN): - unpkg: https://unpkg.com/dumbymap@latest/dist/dumbymap.mjs +## Semantic HTML + +Dumbymap adds several features by Semantic HTML: + +### Code Block for map + +Generated from Element fits CSS Selector `:has(.language-map)` + +It generates maps by `textContent` in YAML format, done by [`mapclay`](/outdoorsafetylab/mapclay). + +For example: +~~~markdown + +```map +use: Maplibre +width: 200px +``` + + +
use: Maplibre
+width: 200px
+~~~ + +### DocLink + +Generated from anchor element which: +1. With has link for [document fragment](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#linking_to_an_element_on_the_same_page). +2. With title starts from `=>` +3. The following text in title would be treated as CSS selector of target element + +It shows leader-line to target element on hover, for example: + +```markdown + +[link](#TEXT "=>.random-class") + + +link +``` + +Generated from anchor element which: +1. With has link for [document fragment](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#linking_to_an_element_on_the_same_page). +2. With title starts from `=>` +3. The following text of title would be treated as CSS selector of target element + +Class name `with-leader-line` and `doclink` would be added to element. + +It shows leader-line to target element on hover, for example: + +```markdown + +[link](#TEXT "=>.random-class") + + +link + + + +link +``` + +### GeoLink + +Generated from anchor element with [geo URI scheme](https://en.wikipedia.org/wiki/Geo_URI_scheme). +Class name `with-leader-line` and `geolink` would be added to element. + +It show leader-line to coordinates in target map elements, for example: + +```markdown + +[Taiwan](geo:24,121) + + +Taiwan + + + +Taiwan +``` + +It changes behaviors by query parameters in link: +1. If `xy` is specified, GeoLink would use its value instead of value in geo URI scheme +2. If `id` is specified, GeoLink would only points to map with its value. Can use comma to add multiple id + +For example: +```html +