Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Icon and Media Support to List - Resolves #906 and #2272 #2316

Merged
merged 101 commits into from
Aug 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
e485b3d
Add support for fontawesome
SPWwj Jun 28, 2023
3572978
Complete list level config
SPWwj Jun 28, 2023
3b6f63e
Add element level config
SPWwj Jun 28, 2023
fb80534
Icon List Usage Documentation Update
SPWwj Jun 30, 2023
f72b476
Update image for icon list doc
SPWwj Jun 30, 2023
afba2c1
Add demo for medial list
SPWwj Jun 30, 2023
262dd6f
Add demo size config
SPWwj Jun 30, 2023
10b7a0e
Update list doc to by pass include render bug
SPWwj Jun 30, 2023
ce43e24
Improve the UG section on lists.
SPWwj Jul 2, 2023
cd0a69e
Update image icon to use padding
SPWwj Jul 2, 2023
21dd1a4
Fix lint errors
SPWwj Jul 2, 2023
3588747
Adhere support to markbind icons
SPWwj Jul 7, 2023
81183d0
Migrate markdown-it-emoji-fixed to ts
SPWwj Jul 7, 2023
59caa54
Fix not support for fa icon
SPWwj Jul 7, 2023
ef18aa1
Convert size to width and height
SPWwj Jul 8, 2023
4fc6ff7
Update icon list from first default to waterfall
SPWwj Jul 8, 2023
4d107b9
Fix lint error
SPWwj Jul 8, 2023
a14d35a
Fix markdown-it-emoji typing
SPWwj Jul 8, 2023
eca3576
Merge branch 'master' into branch-media
SPWwj Jul 8, 2023
2548b86
Add markdown-it-emoji-fixed.d.ts
SPWwj Jul 8, 2023
050ebf1
Fix import markdown-it-emoji-fixed error
SPWwj Jul 10, 2023
d960ab4
Revise docs for clearer icon list explanation
SPWwj Jul 11, 2023
82da76c
Fix lint error for icon style
SPWwj Jul 11, 2023
03b2c35
Refractor markdown-it-icons
SPWwj Jul 12, 2023
1c7806e
Add icon syntax auto correct
SPWwj Jul 12, 2023
c23485b
Switch from Low-Level DOM to Cheerio API
SPWwj Jul 12, 2023
6bfa00f
Complete waterfall model logic
SPWwj Jul 13, 2023
59c1473
Merge branch 'master' into branch-media
SPWwj Jul 13, 2023
1b031ac
Add Attribute Waterfall Logic for Icon List
SPWwj Jul 13, 2023
a61c5b3
Merge branch 'branch-media' of https://github.com/SPWwj/markbind into…
SPWwj Jul 13, 2023
4404c3f
Update icon list doc layout
SPWwj Jul 13, 2023
f73713b
Fix waterfall logic incorrect behaviour
SPWwj Jul 14, 2023
a4d5c16
Update doc for icon list
SPWwj Jul 14, 2023
56522f9
Fix lint error
SPWwj Jul 14, 2023
cf178b9
Refine doc for icon list
SPWwj Jul 15, 2023
3d435fa
Fix lint error
SPWwj Jul 15, 2023
35be3c3
Add support for fontawesome
SPWwj Jun 28, 2023
42052d5
Complete list level config
SPWwj Jun 28, 2023
73a4bfc
Add element level config
SPWwj Jun 28, 2023
3483691
Icon List Usage Documentation Update
SPWwj Jun 30, 2023
3b3ce04
Update image for icon list doc
SPWwj Jun 30, 2023
61a83ad
Add demo for medial list
SPWwj Jun 30, 2023
319ccc0
Add demo size config
SPWwj Jun 30, 2023
7367609
Update list doc to by pass include render bug
SPWwj Jun 30, 2023
4cf49f2
Improve the UG section on lists.
SPWwj Jul 2, 2023
7eaff80
Update image icon to use padding
SPWwj Jul 2, 2023
982aa43
Fix lint errors
SPWwj Jul 2, 2023
58ac61a
Adhere support to markbind icons
SPWwj Jul 7, 2023
d94f448
Migrate markdown-it-emoji-fixed to ts
SPWwj Jul 7, 2023
1138459
Fix not support for fa icon
SPWwj Jul 7, 2023
f703ecc
Convert size to width and height
SPWwj Jul 8, 2023
319f2a8
Update icon list from first default to waterfall
SPWwj Jul 8, 2023
c5d98e3
Fix lint error
SPWwj Jul 8, 2023
eea1431
Fix markdown-it-emoji typing
SPWwj Jul 8, 2023
09ba42e
Add markdown-it-emoji-fixed.d.ts
SPWwj Jul 8, 2023
d61e300
Fix import markdown-it-emoji-fixed error
SPWwj Jul 10, 2023
924c90c
Revise docs for clearer icon list explanation
SPWwj Jul 11, 2023
77d4431
Fix lint error for icon style
SPWwj Jul 11, 2023
25662e1
Refractor markdown-it-icons
SPWwj Jul 12, 2023
097a23e
Add icon syntax auto correct
SPWwj Jul 12, 2023
481228b
Switch from Low-Level DOM to Cheerio API
SPWwj Jul 12, 2023
a0031d8
Complete waterfall model logic
SPWwj Jul 13, 2023
44929ac
Add Attribute Waterfall Logic for Icon List
SPWwj Jul 13, 2023
8d6b7a6
Update icon list doc layout
SPWwj Jul 13, 2023
0db4166
Fix waterfall logic incorrect behaviour
SPWwj Jul 14, 2023
eb5a351
Update doc for icon list
SPWwj Jul 14, 2023
541ef91
Fix lint error
SPWwj Jul 14, 2023
2d1f16d
Refine doc for icon list
SPWwj Jul 15, 2023
04d538e
Fix lint error
SPWwj Jul 15, 2023
6b65bde
Merge branch 'branch-media' of https://github.com/SPWwj/markbind into…
SPWwj Jul 18, 2023
e60535b
Improve code quality.
SPWwj Jul 18, 2023
e46f500
Bfs for waterfall
SPWwj Jul 19, 2023
68632d8
Update to a more specific icon attribute name
SPWwj Jul 19, 2023
2d30fc1
Update test
SPWwj Jul 19, 2023
5713956
Merge branch 'master' into branch-media
SPWwj Jul 19, 2023
f534d69
Add test
SPWwj Jul 19, 2023
0e0aa0d
Update markdown-it-icons to include comments
SPWwj Jul 19, 2023
3d0f2f1
Update doc to add more complicated example
SPWwj Jul 19, 2023
113251f
Prevent reprocessing waterfallModel
SPWwj Jul 19, 2023
309a556
Employ regular object export for markdownItPlugin
SPWwj Jul 23, 2023
4768989
Set image as default fallback for icon
SPWwj Jul 23, 2023
a541746
Clean up the redundant initialization
SPWwj Jul 23, 2023
c5c901a
Update dfs
SPWwj Jul 23, 2023
d76db28
Improved code quality
SPWwj Jul 30, 2023
c22cda1
Update test
SPWwj Jul 30, 2023
cf0f67e
Add more test
SPWwj Jul 30, 2023
96c3332
Update comments
SPWwj Jul 30, 2023
2ba867e
Merge branch 'master' into branch-media
SPWwj Jul 30, 2023
71b66d0
Add flex-shrink to span node
SPWwj Jul 30, 2023
9f65971
Merge branch 'branch-media' of https://github.com/SPWwj/markbind into…
SPWwj Jul 30, 2023
dd979b5
Update test case
SPWwj Jul 30, 2023
137b52b
Update comment
SPWwj Jul 31, 2023
45e4236
Fix lint error
SPWwj Jul 31, 2023
fad29bb
Improve doc for customize list
SPWwj Aug 4, 2023
b005fc3
Remove unused image
SPWwj Aug 4, 2023
46081cc
Fix list doc nits
SPWwj Aug 4, 2023
0273b03
Rename to CustomListIconProcessor
SPWwj Aug 5, 2023
607b70d
Merge branch 'MarkBind:master' into branch-media
SPWwj Aug 5, 2023
df32b5f
Update doc
SPWwj Aug 5, 2023
9e0e616
Merge branch 'branch-media' of https://github.com/SPWwj/markbind into…
SPWwj Aug 5, 2023
5f8d782
Update list icon paragraph description
SPWwj Aug 5, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added docs/images/detailed-d.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/overview-d.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
105 changes: 102 additions & 3 deletions docs/userGuide/syntax/lists.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,115 @@
</variable>
</include>

****Customizing the Unordered list appearance:****

**To customize unordered lists' icons, add the configuration `{icon="icon-name"}` after a specific list item.**

<include src="codeAndOutput.md" boilerplate >
<variable name="highlightStyle">markdown</variable>
<variable name="code">
* Item 1 { icon="glyphicon-education" }
* Item 2
* Item 2.1 { icon="fas-file-code" }
* Item 2.2
* Item 3 { icon="fas-code-branch" }
* Item 3.1
* Item 4 { icon="octicon-git-pull-request" }
* Item 4.1 { icon="mif-perm-media" }
* Item 5 { icon="glyphicon-education" }
* Item 5.1 { icon="notebook_with_decorative_cover" }
</variable>
</include>

You can use any of the [icons](../formattingContents.html#icons) supported by MarkBind. If an item has a specified icon, that icon will be used for it and for subsequent items at that level.

<box type=warning seamless>
If you customize any item on a certain level, you must also customize the first item on that level. If not, the list will revert to its uncustomized form.
</box>

**You can adjust the icon's size by using the `i-size` attribute.**

<include src="codeAndOutput.md" boilerplate >
<variable name="highlightStyle">markdown</variable>
<variable name="code">

* Item 1 { icon="fas-file-code" i-size="35px" }
* Item 2 { icon="fas-file-code" i-size="4rem" }
* Item 3 { icon="fas-file-code" i-size="5em" }

</variable>
</include>

You can utilize any [CSS size unit](https://www.w3schools.com/cssref/css_units.php).

**You can also use images as icons.**

<include src="codeAndOutput.md" boilerplate >
<variable name="highlightStyle">markdown</variable>
<variable name="code">

* Item 1 { icon="/images/deer.jpg" i-width="30px" }
* Item 2 { i-width="60px" i-height="44px" }
* Item 3 { i-width="90px" i-height="61px" }

</variable>
</include>

If either the `i-width` or the `i-height` of an image is not specified, the unspecified dimension will adjust to maintain the image's original aspect ratio. For example, for an image of size 800x600 (4:3), if `i-width` is set to 400px, its height will be 300px.

**The icon's appearance can be further customized by adding a `i-class` attribute.**

<div id="main-example-markbind">

<include src="codeAndOutput.md" boilerplate >
<variable name="highlightStyle">markdown</variable>
<variable name="code">
* Item 1 { icon="/images/deer.jpg" i-width="60px" height="17px" i-class="rounded" }
* Item 2
* Item 2.1 { icon="fas-question-circle" i-class="badge rounded-pill my-1 bg-success text-white" }
* Item 2.2
* Item 2.3 { i-class="badge rounded-pill my-1 bg-primary text-white"}
* Item 3
* Item 3.1
* Item 3.2 { icon="fas-question-circle" i-class="badge rounded my-1 bg-danger text-white" }
* Item 3.3
</variable>
</include>

<box type=tip seamless>

Similar to the `icon` attribute, other icon attributes such as `i-class`, `i-width`, `i-height` apply for subsequent list items at the same level, until they are overridden by the same attribute. For example, Item 2.3's `i-class` overrides Item 2.1's and applies up to Item 3.1.
</box>

</div>

**You can apply Markdown's heading and paragraph syntax within the list.**

<include src="codeAndOutput.md" boilerplate >
<variable name="highlightStyle">markdown</variable>
<variable name="code">

* #### Heading 1: Overview {icon="/images/overview-d.png" i-width="65px" i-class="rounded" }
Content 1: This section provides a summary of the document or topic.
It sets the context and purpose of the content to follow.
* #### Heading 2: Detailed Description { icon="/images/detailed-d.png" i-width="65px" i-class="rounded" }
Content 2: This section delves deeper into the topic, offering comprehensive information and detailed explanations.
It might also include evidence, examples, or justifications.
</variable>
</include>

Icon specifications should be attached only to the first element of a list item (for the example above, the icon specification should be attached to the heading, not the content below the heading).

****Ordered lists:****

<include src="codeAndOutput.md" boilerplate >
<variable name="highlightStyle">markdown</variable>
<variable name="code">
1. Item 1
1. Sub item 1.1
1. Sub item 1.2
1. Item 2
1. Item 3
2. Sub item 1.2
2. Item 2
3. Item 3
</variable>
</include>

Expand Down
6 changes: 6 additions & 0 deletions packages/cli/test/functional/test_site/expected/siteData.json
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,12 @@
"i-am-a-header": "🚀 I am a header"
},
"headingKeywords": {}
},
{
"src": "testList.md",
"title": "web 3 forms",
"headings": {},
"headingKeywords": {}
}
]
}
Loading