Skip to content

Commit e583b16

Browse files
Update preview source for images and icons
1 parent 7dd2094 commit e583b16

File tree

5 files changed

+189
-103
lines changed

5 files changed

+189
-103
lines changed

preview-src/asciidoc/images.adoc

Lines changed: 168 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
= Images and media
1+
= Images, icons, and media
22
:idprefix:
33
:idseparator: -
44
:figure-caption!:
@@ -8,24 +8,24 @@
88
== Block images
99

1010
.Optional title
11-
image::../img/screenshot.png[Screenshot of Astra Portal Home]
11+
image::../img/screenshot.png[[alt="Screenshot of Astra Portal Home"]
1212

1313
=== Sizing and alignment
1414

15-
.400px width, align="left"
16-
image::../img/screenshot.png[Screenshot of Astra Portal Home,400,align="left"]
15+
.width=400,align=left
16+
image::../img/screenshot.png[[alt="Screenshot of Astra Portal Home",width=400,align=left]
1717

18-
.400px width, align="right"
19-
image::../img/screenshot.png[Screenshot of Astra Portal Home,400,align="right"]
18+
.width=400 width,align=right
19+
image::../img/screenshot.png[[alt="Screenshot of Astra Portal Home",width=400,align=right]
2020

21-
.400px width, align="center"
22-
image::../img/screenshot.png[Screenshot of Astra Portal Home,400,align="center"]
21+
.width=400 width,align=center
22+
image::../img/screenshot.png[[alt="Screenshot of Astra Portal Home",width=400,align=center]
2323

2424
=== Float
2525

2626
[.float-group]
2727
--
28-
image:../img/screenshot.png[Screenshot of Astra Portal Home,300,float=right,role=float-gap]
28+
image:../img/screenshot.png[[alt="Screenshot of Astra Portal Home",300,float=right,role=float-gap]
2929
In AsciiDoc, creating paragraphs is a straightforward process that does not require any special markup. A paragraph can be defined as one or more lines of consecutive text that are logically grouped together. To differentiate between paragraphs, you simply need to insert at least one blank line between them.
3030
--
3131

@@ -35,178 +35,244 @@ image::../img/multirepo-ssg.svg[Multirepo SSG,300,float=left,role=float-gap]
3535
In AsciiDoc, creating paragraphs is a straightforward process that does not require any special markup. A paragraph can be defined as one or more lines of consecutive text that are logically grouped together. To differentiate between paragraphs, you simply need to insert at least one blank line between them.
3636
--
3737

38-
== Inline images
39-
40-
Click image:../img/play_circle_FILL0_wght400_GRAD0_opsz24.svg[title=Play] to get the party started.
38+
=== Light and dark mode images
4139

42-
Click image:../img/pause_circle_FILL0_wght400_GRAD0_opsz24.svg[title=Pause] when you need a break.
40+
You can make an image appear differently in light mode vs. dark mode.
4341

44-
== Image theming (light/dark mode)
42+
==== Two separate images
4543

4644
[NOTE]
47-
======
48-
You can define an image such that it appears differently in light mode vs. dark mode.
49-
There are methods for doing this.
45+
====
46+
Define two images: one that looks good in light mode, and one that looks good in dark mode.
47+
Then, assign the corresponding `for-light` and `for-dark` roles to each image.
48+
49+
* All non-SVG images, such as screenshot PNG files, must use this method.
50+
* All SVG images that do not use <<svg-images-css,CSS variables>> must use this method.
5051
51-
Method 1: Two separate images::
52-
Define two images, one that looks good in light mode and one that looks good in dark mode.
53-
Assign the corresponding roles -- `for-light` and `for-dark` -- to each image.
54-
+
55-
All non-SVG images, such as screenshot PNG files, must use this method.
56-
All SVG images that do not use CSS variables must also use this method.
57-
+
58-
.block image
59-
[source,asciidoc]
60-
----
61-
image::light-mode-illustration.png[Alt text,400,role=for-light]
62-
image::dark-mode-illustration.png[Alt text,400,role=for-dark]
63-
----
64-
+
65-
.inline image
6652
[source,asciidoc]
6753
----
68-
Click the Astra Vector icon image:../img/astra-vector-light.svg[title="Astra Vector",role=for-light] image:../img/astra-vector-dark.svg[title="Astra Vector",role=for-dark].
54+
image::vector-ui-light.png[alt="Alt text",width=400,role=for-light]
55+
image::vector-ui-dark.png[alt="Alt text",width=400,role=for-dark]
6956
----
57+
====
58+
59+
image::../img/vector-ui-light.png[alt="Alt text",width=400,role=for-light]
60+
image::../img/vector-ui-dark.png[alt="Alt text",width=400,role=for-dark]
61+
62+
[#svg-images-css]
63+
==== SVG images with CSS variables
7064

71-
Method 2: SVG image with CSS variables::
65+
[NOTE]
66+
======
7267
Use the custom `svg` macro to define an SVG image that uses CSS variables to support light and dark mode.
73-
+
74-
.block svg
75-
[source,asciidoc]
76-
----
77-
svg::ROOT:illustration.svg[Alt text,400]
78-
----
79-
+
80-
.inline svg
68+
8169
[source,asciidoc]
8270
----
83-
Click the Astra Vector icon svg:ROOT:your-diagram.svg[title="Astra Vector"].
71+
svg::ROOT:illustration.svg[alt="Alt text",width=400]
8472
----
85-
+
73+
74+
The `svg` macro supports the following attributes: `width`, `height`, `role`, `alt`, and `title`.
75+
8676
[IMPORTANT]
8777
====
8878
CSS variables must use the tokens supported by the UI.
8979
For example:
9080

91-
[source,svg]
81+
[source,svg,subs="+quotes"]
9282
----
9383
<svg viewBox="0 0 300 200" fill="none">
94-
<path fill="var(--ds-text-primary)" d="..." />
95-
<path stroke="var(--ds-primary-outlined-border)" d="..." />
96-
<path fill="var(--ds-neutral-outlined-border)" d="..." />
84+
<path fill="**var(--ds-text-primary)**" d="..." />
85+
<path stroke="**var(--ds-primary-outlined-border)**" d="..." />
86+
<path fill="**var(--ds-neutral-outlined-border)**" d="..." />
9787
</svg>
9888
----
9989
====
10090
======
10191

102-
.themed block image
103-
image::../img/light-mode-illustration.png[Alt text,400,role=for-light]
92+
// svg::../img/quickstart-overview.svg[]
10493

105-
.themed block image
106-
image::../img/dark-mode-illustration.png[Alt text,400,role=for-dark]
94+
[#icons]
95+
== Icons
10796

108-
.themed inline image
109-
Click the Astra Vector icon image:../img/astra-vector-light.svg[title="Astra Vector",role=for-light] image:../img/astra-vector-dark.svg[title="Astra Vector",role=for-dark].
97+
You can add icons in line with text and other elements.
11098

111-
== Icons
99+
[#font-icons]
100+
=== Font icons
112101

113102
[NOTE]
114103
======
115-
You can define icons from https://fonts.google.com/icons?icon.set=Material+Icons&icon.style=Outlined[Material Icons,window=_blank] and https://lucide.dev/icons/[Lucide Icons,window=_blank] with the icon macro. You can also create custom icons with SVG files using the svg macro.
104+
Use the `icon` macro to invoke font icons from https://lucide.dev/icons/[Lucide Icons] and https://fonts.google.com/icons[Material Icons].
105+
The `icon` macro follows https://developers.google.com/style/ui-elements#buttons[accessibility standards] and provides built-in support for light and dark mode.
116106
117-
Method 1: icon macro::
118-
The inline icon macro accepts a Lucide or Material icon name as the target source.
119-
+
120-
This method supports light and dark mode automatically.
121-
+
122-
[source,title="Lucide"]
107+
Lucide is the default icon set.
108+
You can invoke a Lucide icon with either `\icon:icon-name[]` or `\icon:lucide:icon-name[]`:
109+
110+
.Lucide
111+
[source,asciidoc]
123112
----
124-
// the icon macro uses lucide by default
125-
icon:boom-box[]
126-
// or specifiy lucide
127-
icon:lucide:boom-box[]
113+
Click icon:settings[name="Settings"] to configure your settings. // <.>
128114
129-
// show the icon with visible text to the right
130-
Click icon:settings[name="Settings"] to configure your settings.
115+
icon:moon[alt="That's no moon"] // <.>
131116
132-
// alt or title attribute create an aria-label
133-
icon:atom[title="Split the atom"]
134-
icon:moon[alt="That's no moon"]
117+
icon:atom[title="Split the atom"] // <.>
135118
136-
// customize with tailwind classes as the role
137-
With tailwind roles icon:star[role="text-amber-600 text-2xl"]
119+
icon:star[role="text-amber-600 text-2xl"] // <.>
138120
139-
// customize the size in px
140-
icon:star[size="60"]
121+
icon:star[size="60"] // <.>
141122
----
142-
+
143-
[source,title="Material"]
123+
<.> Use the `name` attribute to add visible text to the right of the icon.
124+
125+
<.> Use the `alt` attribute to define an `aria-label` label for the icon.
126+
The text is invisible but is read by screen readers.
127+
_Do not use `alt` if `name` or `title` is already defined._
128+
129+
<.> The `title` attribute does the same thing as `alt`, except the text is also visible as a tooltip on hover.
130+
_Do not use `title` if `name` or `alt` is already defined._
131+
132+
<.> Use the `role` attribute to apply Tailwind CSS classes to the icon.
133+
134+
<.> Use the `size` attribute to define the icon size in pixels.
135+
136+
You can invoke a Material icon with `\icon:material:icon-name[]`.
137+
All of the same attributes apply:
138+
139+
.Material
140+
[source,asciidoc]
144141
----
145-
// specifiy material
146-
icon:material:chevron-down[]
142+
Click icon:material:settings[name="Settings"] to configure your settings.
147143
148-
// alt or title attribute create an aria-label
149144
icon:material:air[alt="Whooosh"]
150145
151-
// customize with tailwind classes as the role
146+
icon:material:volume-up[title="Turn it up"]
147+
152148
icon:material:directions-boat[role="text-amber-600 text-2xl"]
153149
154-
// customize the size in px
155-
icon:material:thumb-up[size=60]
150+
icon:material:thumb-up[size=60]
156151
----
157152
158-
Method 2: svg macro with icon role::
159-
Display a local SVG file with the icon role.
160-
+
161-
This methods supports using CSS variables within the svg.
162-
+
163-
[source]
164-
----
165-
svg:ROOT:ui/icons/vector.svg[role="icon"]
166-
----
153+
.Legacy font icon methods
154+
[%collapsible]
155+
=====
156+
[WARNING]
157+
====
158+
These methods were previously used to invoke font icons and should no longer be used.
159+
====
167160

168-
Method 3: block or inline span with material-icons role::
169-
Use the custom role `material-icons` on block or inline content. The content must be a material icon name in lower case. If there are spaces in the name, use underscores instead.
161+
Block or inline span with material-icons role::
170162
+
163+
--
164+
Use the custom role `material-icons` on block or inline content. The content must be a material icon name in lower case. If there are spaces in the name, use underscores instead.
165+
171166
This method supports light and dark mode automatically.
172-
+
167+
173168
.block style
174169
[source]
175170
----
176171
[.material-icons]
177172
thumb_up
178173
----
179-
+
174+
180175
.Inline style using a text span
181176
[source]
182177
----
183178
Inline material icons [.material-icons]#thumb_up#
184179
----
185-
+
180+
186181
[.material-icons]#thumb_up# [.material-icons]#rocket_launch#
182+
--
187183

188-
Method 4: HTML passthrough::
189-
Use block or inline HTML passthrough to create an icon element `<i class="icon-{icon-name}"></i>`.
184+
HTML passthrough::
190185
+
186+
--
187+
Use block or inline HTML passthrough to create an icon element `<i class="icon-{icon-name}"></i>`.
188+
191189
This method supports light and dark mode automatically.
192-
+
190+
193191
.Block passthrough
194192
[source]
195193
----
196194
++++
197195
<i class="icon-boom-box"></i>
198196
++++
199197
----
200-
+
198+
201199
.Inline passthrough
202200
[source]
203201
----
204202
Inline lucide icons +++<i class="icon-boom-box"></i>+++
205203
----
206-
+
204+
207205
+++<i class="icon-boom-box"></i>+++ +++<i class="icon-atom"></i>+++ +++<i class="icon-moon"></i>+++
206+
--
207+
=====
208208
======
209209

210+
// Lucide::
211+
// +
212+
// Click icon:settings[name="Settings"] to configure your settings.
213+
// +
214+
// icon:moon[alt="That's no moon"]
215+
// +
216+
// icon:atom[title="Split the atom"]
217+
// +
218+
// icon:star[role="text-amber-600 text-2xl"]
219+
// +
220+
// icon:star[size="60"]
221+
222+
// Material::
223+
// +
224+
// Click icon:material:settings[name="Settings"] to configure your settings.
225+
// +
226+
// icon:material:air[alt="Whooosh"]
227+
// +
228+
// icon:material:volume-up[title="Turn it up"]
229+
// +
230+
// icon:material:directions-boat[role="text-amber-600 text-2xl"]
231+
// +
232+
// icon:material:thumb-up[size=60]
233+
234+
=== SVG icons
235+
236+
[NOTE]
237+
======
238+
Use the inline `svg` macro to display a local SVG file as an icon.
239+
240+
[source,asciidoc]
241+
----
242+
svg:ROOT:ui/icons/vector.svg[role="icon"] // <.>
243+
244+
svg:ROOT:ui/icons/vector.svg[role="icon text-2xl"] // <.>
245+
246+
Click svg:ROOT:ui/icons/vector.svg[role="icon text-2xl"] *Search* to run a similarity search based on the selected document's vector.
247+
----
248+
249+
<.> The `icon` role adds CSS styles that pin the width and height of the image to the font size of the parent element.
250+
Without the `icon` role, the image displays as large as possible unless a width and height is set in the SVG file itself (not recommended).
251+
252+
<.> Setting the `icon` role by itself usually leads to the icon appearing too small.
253+
You can control the size of the icon with Tailwind `text-*` utilities, with `text-2xl` being the ideal size when the icon is used within body text.
254+
255+
[IMPORTANT]
256+
====
257+
Unlike <<font-icons,font icons>>, the `svg` macro doesn't automatically support light and dark mode.
258+
You'll need to add supported <<svg-images-css,CSS variables>> to the SVG file for the icon to display properly in light and dark mode.
259+
====
260+
======
261+
262+
// Click svg:ROOT:ui/icons/vector.svg[role="icon text-2xl"] *Search* to run a similarity search based on the selected document's vector.
263+
264+
[#inline-images]
265+
== Inline images
266+
267+
[IMPORTANT]
268+
====
269+
Avoid using inline images.
270+
Use <<icons>> instead.
271+
====
272+
273+
Click image:../img/play_circle_FILL0_wght400_GRAD0_opsz24.svg[title=Play] to get the party started.
274+
275+
Click image:../img/pause_circle_FILL0_wght400_GRAD0_opsz24.svg[title=Pause] when you need a break.
210276

211277
== Video
212278

-451 KB
Binary file not shown.
-456 KB
Binary file not shown.

0 commit comments

Comments
 (0)