Skip to content

Commit f9a5250

Browse files
committed
fix: Markdown is no longer supported in listings (>= 1.7.5)
Fixes #11758
1 parent 247513c commit f9a5250

File tree

8 files changed

+132
-91
lines changed

8 files changed

+132
-91
lines changed

src/resources/projects/website/listing/_filter.ejs.md

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,29 @@ const sortUi = listing['sort-ui'];
1010
<% const sortableFields = listing.utilities.sortableFieldData(); %>
1111
<% if (sortUi && sortableFields.length > 0) { %>
1212
<div class="input-group input-group-sm quarto-listing-sort">
13-
<span class="input-group-text"><i class="bi bi-sort-down"></i></span>
14-
<select
13+
<span class="input-group-text"><i class="bi bi-sort-down"></i></span>
14+
<select
1515
id="listing-<%- listing.id %>-sort"
1616
class="form-select"
17-
aria-label="<%- listing.utilities.localizedString("listing-page-order-by")%>"
17+
aria-label="<%- listing.utilities.localizedString("listing-page-order-by") %>"
1818
onChange="window['quarto-listings']['listing-<%- listing.id %>'].sort(this.options[this.selectedIndex].value, { order: this.options[this.selectedIndex].getAttribute('data-direction')})"
1919
>
20-
<option value="" disabled selected hidden><%- listing.utilities.localizedString("listing-page-order-by")%></option>
21-
<option value="index" data-direction="asc"><%- listing.utilities.localizedString("listing-page-order-by-default")%></option>
22-
<% for (const sortData of sortableFields) { %>
23-
<option
24-
value="<%- sortData.listingSort.field %>"
25-
data-direction="<%- sortData.listingSort.direction %>">
26-
<%= sortData.description %>
27-
</option>
28-
<% } %>
29-
</select>
20+
<option value="" disabled selected hidden><%- listing.utilities.localizedString("listing-page-order-by") %></option>
21+
<option value="index" data-direction="asc"><%- listing.utilities.localizedString("listing-page-order-by-default") %></option>
22+
<% for (const sortData of sortableFields) { %>
23+
<option
24+
value="<%- sortData.listingSort.field %>"
25+
data-direction="<%- sortData.listingSort.direction %>">
26+
<%- sortData.description %>
27+
</option>
28+
<% } %>
29+
</select>
3030
</div>
31-
32-
3331
<% } %>
34-
3532
<% if (filterUi) { %>
3633
<div class="input-group input-group-sm quarto-listing-filter">
3734
<span class="input-group-text"><i class="bi bi-search"></i></span>
38-
<input type="text" class="search form-control" placeholder="<%- listing.utilities.localizedString("listing-page-filter")%>" />
35+
<input type="text" class="search form-control" placeholder="<%- listing.utilities.localizedString("listing-page-filter") %>" />
3936
</div>
4037
<% } %>
4138
</div>

src/resources/projects/website/listing/_metadata.ejs.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
const categories = item.categories !== undefined ? item.categories.join(',') : undefined;
33
%>
44

5+
```{=html}
56
<div class="quarto-listing-item-metadata" style-"display:none;">
67
<span class="original-value" data-original-value="${itemNumber}" style="display:none;"></span>
78
<% if (categories !== undefined) { %><span class="categories" data-categories="${categories}" style="display:none;"></span><% } %>
89
</div>
10+
```
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
<div class="listing-no-matching d-none"><%- listing.utilities.localizedString("listing-page-no-matches")%></div>
2-
<% if (listing["page-size"] < items.length) { %>
31
```{=html}
2+
<div class="listing-no-matching d-none">
3+
<%- listing.utilities.localizedString("listing-page-no-matches") %>
4+
</div>
5+
<% if (listing["page-size"] < items.length) { %>
46
<nav id="<%- listing.id %>-pagination" class="listing-pagination" aria-label="Page Navigation">
57
<ul class="pagination"></ul>
68
</nav>
7-
```
89
<% } %>
10+
```

src/resources/projects/website/listing/item-default.ejs.md

Lines changed: 42 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -31,44 +31,64 @@ return value;
3131

3232
let value = readField(item, field);
3333
if (value !== undefined) {
34-
print(`<div class="metadata-value listing-${field}">${listing.utilities.outputLink(item, field, value)}</div>`);
34+
print(`<div class="metadata-value listing-${field}">${listing.utilities.outputLink(item, field, value)}</div>`);
3535
}
3636
}
3737
%>
3838

39-
<div class="quarto-post image-<%= imageAlign %>" <%= listing.utilities.metadataAttrs(item) %>>
39+
::: {.quarto-post .image-<%= imageAlign %> <%= listing.utilities.metadataAttrs(item) %>}
40+
4041
<% if (fields.includes('image')) { %>
41-
<div class="thumbnail">
42-
<a href="<%- item.path %>" class="no-external">
42+
`<div class="thumbnail"><a href="<%- item.path %>" class="no-external">`{=html}
4343
<% if (item.image) { %>
4444
<%= listing.utilities.img(itemNumber, item.image, "thumbnail-image", item['image-alt'], item['image-lazy-loading'] ?? listing['image-lazy-loading']) %>
4545
<% } else { %>
4646
<%= listing.utilities.imgPlaceholder(listing.id, itemNumber, item.outputHref) %>
4747
<% } %>
48-
</a>
49-
</div>
48+
`</a></div>`{=html}
5049
<% } %>
51-
<div class="body">
50+
51+
::: {.body}
52+
5253
<% if (fields.includes('title')) { %>
53-
<h3 class="no-anchor listing-title"><a href="<%- item.path %>" class="no-external"><%= item.title %></a></h3>
54-
<div class="listing-subtitle"><a href="<%- item.path %>" class="no-external"><%= item.subtitle %></a></div>
54+
`<h3 class="no-anchor listing-title"><a href="<%- item.path %>" class="no-external">`{=html} <%= item.title %> `</a></h3>`{=html}
55+
<% if (fields.includes('subtitle')) { %>
56+
`<div class="listing-subtitle"><a href="<%- item.path %>" class="no-external">`{=html} <%= item.subtitle %> `</a></div>`{=html}
57+
<% } %>
5558
<% } %>
56-
<% if (fields.includes('categories') && item.categories) { %>
57-
<div class="listing-categories">
59+
60+
<% if (fields.includes('categories') && item.categories) { %>
61+
`<div class="listing-categories">`{=html}
5862
<% for (const category of item.categories) { %>
59-
<div class="listing-category" onclick="window.quartoListingCategory('<%=utils.b64encode(category)%>'); return false;"><%= category %></div>
63+
`<div class="listing-category" onclick="window.quartoListingCategory('<%- utils.b64encode(category) %>'); return false;">`{=html} <%= category %> `</div>`{=html}
64+
<% } %>
65+
`</div>`{=html}
6066
<% } %>
61-
</div>
62-
<% } %>
67+
6368
<% if (fields.includes('description')) { %>
64-
<div class="delink listing-description"><a href="<%- item.path %>" class="no-external"><%= item.description %></a></div>
69+
`<div class="delink listing-description"><a href="<%- item.path %>" class="no-external">`{=html} <%= item.description %> `</a></div>`{=html}
70+
<% } %>
71+
72+
:::
73+
74+
::: {.metadata}
75+
`<a href="<%- item.path %>" class="no-external">`{=html}
76+
<% if (fields.includes('date') && item.date) { %>
77+
`<div class="listing-date">`{=html} <%= item.date %> `</div>`{=html}
78+
<% } %>
79+
80+
<% if (fields.includes('author') && item.author) { %>
81+
`<div class="listing-author">`{=html} <%= item.author %> `</div>`{=html}
6582
<% } %>
66-
</div>
67-
<div class="metadata"><a href="<%- item.path %>" class="no-external">
68-
<% if (fields.includes('date') && item.date) { %><div class="listing-date"><%= item.date %></div><% } %>
69-
<% if (fields.includes('author') && item.author) { %><div class="listing-author"><%= item.author %></div><% } %>
70-
<% if (fields.includes('reading-time') && item['reading-time']) { %> <div class="listing-reading-time"><%= item['reading-time'] %></div> <% } %>
83+
84+
<% if (fields.includes('reading-time') && item['reading-time']) { %>
85+
`<div class="listing-reading-time">`{=html} <%= item['reading-time'] %> `</div>`{=html}
86+
<% } %>
87+
7188
<% for (const field of otherFields) { %>
72-
<% outputMetadata(item, field) %><% } %></a></div>
89+
<% outputMetadata(item, field) %>
90+
<% } %>
91+
`</a>`{=html}
92+
:::
7393

74-
</div>
94+
:::

src/resources/projects/website/listing/item-grid.ejs.md

Lines changed: 60 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -37,83 +37,101 @@ return !["title", "image", "image-alt", "date", "author", "subtitle", "descripti
3737
});
3838
%>
3939

40-
<div class="g-col-1" <%= listing.utilities.metadataAttrs(item) %>>
40+
::: {.g-col-1 <%= listing.utilities.metadataAttrs(item) %> }
41+
42+
```{=html}
4143
<a href="<%- item.path %>" class="quarto-grid-link">
42-
<div class="quarto-grid-item card h-100 <%-`card-${align}`%><%= hideBorders ? ' borderless' : '' %>">
44+
<div class="quarto-grid-item card h-100 <%- `card-${align}` %><%- hideBorders ? ' borderless' : '' %>">
45+
```
4346

4447
<% if (fields.includes('image')) { %>
45-
4648
<% if (item.image) { %>
47-
48-
<p class="card-img-top">
49+
`<p class="card-img-top">`{=html}
4950
<%= listing.utilities.img(itemNumber, item.image, "thumbnail-image card-img", item['image-alt'], item['image-lazy-loading'] ?? listing['image-lazy-loading']) %>
50-
</p>
51+
`</p>`{=html}
5152
<% } else { %>
5253
<%= listing.utilities.imgPlaceholder(listing.id, itemNumber, item.outputHref) %>
5354
<% } %>
5455

5556
<% } %>
5657
<% if (showField('title') || showField('subtitle') || showField('description') || showField('author') || showField('date') || otherFields.length > 0) { %>
5758

58-
<div class="card-body post-contents">
59-
<% if (showField('title')) { %><h5 class="no-anchor card-title listing-title"><%= item.title %></h5><% } %>
60-
<% if (showField('subtitle')) { %><div class="card-subtitle listing-subtitle"><%= item.subtitle %></div><% } %>
61-
<% if (showField('reading-time')) { %><div class="listing-reading-time card-text text-muted"><%= item['reading-time'] %></div> <% } %>
59+
`<div class="card-body post-contents">`{=html}
60+
61+
<% if (showField('title')) { %>
62+
`<h5 class="no-anchor card-title listing-title">`{=html} <%= item.title %> `</h5>`{=html}
63+
<% } %>
64+
65+
<% if (showField('subtitle')) { %>
66+
`<div class="card-subtitle listing-subtitle">`{=html} <%= item.subtitle %> `</div>`{=html}
67+
<% } %>
68+
69+
<% if (showField('reading-time')) { %>
70+
`<div class="listing-reading-time card-text text-muted">`{=html} <%= item['reading-time'] %> `</div>`{=html}
71+
<% } %>
6272

6373
<% if (fields.includes('categories') && item.categories) { %>
74+
`<div class="listing-categories">`{=html}
6475

65-
<div class="listing-categories">
66-
<% for (const category of item.categories) { %>
67-
<div class="listing-category" onclick="window.quartoListingCategory('<%=utils.b64encode(category)%>'); return false;"><%= category %></div>
68-
<% } %>
69-
</div>
76+
<% for (const category of item.categories) { %>
77+
`<div class="listing-category" onclick="window.quartoListingCategory('<%- utils.b64encode(category ) %>'); return false;">`{=html} <%= category %> `</div>`{=html}
78+
<% } %>
7079

80+
`</div>`{=html}
7181
<% } %>
72-
<% if (showField('description')) { %>
7382

74-
<div class="card-text listing-description delink"><%= item.description %></div>
83+
<% if (showField('description')) { %>
84+
`<div class="card-text listing-description delink">`{=html} <%= item.description %> `</div>`{=html}
7585
<% } %>
76-
<%
86+
87+
<%
7788
const flexJustify = showField('author') && showField('date') ? "justify" : showField('author') ? "start" : "end";
7889
%>
90+
7991
<% if (showField('author') || showField('date')) { %>
80-
<div class="card-attribution card-text-small <%-flexJustify%>">
81-
<% if (showField('author')) { %><div class="listing-author"><%= item.author %></div><% } %>
82-
<% if (showField('date')) { %><div class="listing-date"><%= item.date %></div><% } %>
83-
</div>
92+
`<div class="card-attribution card-text-small <%- flexJustify %>">`{=html}
93+
94+
<% if (showField('author')) { %>
95+
`<div class="listing-author">`{=html} <%= item.author %> `</div>`{=html}
8496
<% } %>
8597

86-
<% if (otherFields.length > 0) { %>
98+
<% if (showField('date')) { %>
99+
`<div class="listing-date">`{=html} <%= item.date %> `</div>`{=html}
100+
<% } %>
87101

88-
<table class="card-other-values">
89-
<% for (const field of otherFields) {
90-
let value = readField(item, field);
91-
%>
92-
<tr>
93-
<td><%= listing.utilities.fieldName(field) %></td>
94-
<td class="<%-field%>"><%= listing.utilities.outputLink(item, field, value) %></td>
95-
</tr>
102+
`</div>`{=html}
96103
<% } %>
97-
</table>
98104

105+
<% if (otherFields.length > 0) { %>
106+
`<table class="card-other-values">`{=html}
107+
<% for (const field of otherFields) {
108+
let value = readField(item, field);
109+
%>
110+
`<tr>`{=html}
111+
`<td>`{=html} <%= listing.utilities.fieldName(field) %> `</td>`{=html}
112+
`<td class="<%- field %>">`{=html} <%= listing.utilities.outputLink(item, field, value) %> `</td>`{=html}
113+
`</tr>`{=html}
114+
<% } %>
115+
`</table>`{=html}
99116
<% } %>
100117

101-
</div>
118+
`</div>`{=html}
102119
<% } %>
103120

104121
<% if (fields.includes('filename') || fields.includes('file-modified')) { %>
105122

106-
<div class="card-footer">
123+
`<div class="card-footer">`{=html}
124+
107125
<% if (fields.includes('filename')) { %>
108-
<div class="card-filename listing-filename">
109-
<%= item.filename ? item.filename : "&nbsp;" %>
110-
</div>
126+
`<div class="card-filename listing-filename">`{=html} <%= item.filename ? item.filename : "&nbsp;" %> `</div>`{=html}
111127
<% } %>
128+
112129
<% if (fields.includes('file-modified')) { %>
113-
<div class="card-file-modified listing-file-modified">
114-
<%= item['file-modified'] ? item['file-modified'] : "&nbsp;"%>
115-
</div>
130+
`<div class="card-file-modified listing-file-modified">`{=html} <%= item['file-modified'] ? item['file-modified'] : "&nbsp;" %> `</div>`{=html}
116131
<% } %>
117-
</div>
132+
133+
`</div>`{=html}
118134
<% } %>
119-
</div></a></div>
135+
`</div></a>`{=html}
136+
137+
:::
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
:::{.list .quarto-listing-default}
2-
``````{=html}
1+
::: {.list .quarto-listing-default}
2+
33
<% for (const item of items) { %>
44
<% partial('item-default.ejs.md', {listing, item, utils }) %>
55
<% } %>
6-
``````
6+
77
:::

src/resources/projects/website/listing/listing-grid.ejs.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
const cols = listing['grid-columns'];
33
%>
44

5-
:::{.list .grid .quarto-listing-cols-<%=cols%>}
6-
```{=html}
5+
::: {.list .grid .quarto-listing-cols-<%= cols %>}
6+
77
<% for (const item of items) { %>
88
<% partial('item-grid.ejs.md', {listing, item, utils }) %>
99
<% } %>
10-
```
10+
1111
:::

src/resources/projects/website/listing/listing-table.ejs.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,13 @@ return listing.utilities.outputLink(item, field, value, `listing-${field}`);
8484
<tr <%= listing.utilities.metadataAttrs(item) %><%= onclick(item) %>>
8585
<% for (const field of fields){ %>
8686
<td>
87+
```
8788
<%= outputValue(itemNumber, field) %>
89+
```{=html}
8890
</td>
8991
<% } %>
9092
</tr>
9193
<% } %>
9294
</tbody>
9395
</table>
94-
```
96+
```

0 commit comments

Comments
 (0)