File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 5
5
6
6
import collections .abc as abc
7
7
from dataclasses import dataclass
8
+ from pathlib import Path
8
9
from typing import TypeAlias , Optional , Sequence
9
10
10
11
from quartodoc .pandoc .components import Attr
11
12
12
13
__all__ = (
13
14
"Code" ,
14
15
"Emph" ,
16
+ "Image" ,
15
17
"Inline" ,
16
18
"Inlines" ,
17
19
"Link" ,
@@ -170,6 +172,28 @@ def __str__(self):
170
172
return f"*{ content } *"
171
173
172
174
175
+ @dataclass
176
+ class Image (Inline ):
177
+ """
178
+ Image
179
+ """
180
+
181
+ caption : Optional [str ] = None
182
+ src : Optional [Path | str ] = None
183
+ title : Optional [str ] = None
184
+ attr : Optional [Attr ] = None
185
+
186
+ def __str__ (self ):
187
+ """
188
+ Return image as markdown
189
+ """
190
+ caption = self .caption or ""
191
+ src = self .src or ""
192
+ title = f' "{ self .title } "' if self .title else ""
193
+ attr = f"{{{ self .attr } }}" if self .attr else ""
194
+ return f"{ attr } "
195
+
196
+
173
197
# Helper functions
174
198
175
199
def join_inline_content (content : Sequence [InlineContent ]) -> str :
You can’t perform that action at this time.
0 commit comments