Skip to content

Commit d8e9b83

Browse files
committed
wrap table
1 parent d5e0d61 commit d8e9b83

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/anki_search.cpp

+8-3
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,18 @@ gd-ankisearch --field-name VocabKanji --word %GDWORD%
4545
gd-ankisearch --deck-name Mining --word %GDWORD%
4646
)EOF";
4747
static constexpr std::string_view css_style = R"EOF(<style>
48+
.gd-table-wrap {
49+
max-width: 100%;
50+
overflow-x: auto;
51+
}
4852
.gd-ankisearch-table {
4953
font-family: arial, sans-serif;
5054
border-collapse: collapse;
5155
border-spacing: 0;
5256
max-width: 100%;
5357
width: 100%;
54-
display: block;
55-
overflow-x: auto;
5658
overscroll-behavior-inline: contain;
59+
margin: 0 auto;
5760
}
5861
.gd-ankisearch-table td,
5962
.gd-ankisearch-table th {
@@ -311,6 +314,7 @@ void print_cards_info(search_params const& params)
311314
return fmt::print("No cards found.\n");
312315
}
313316
auto const media_dir_path = fetch_media_dir_path();
317+
fmt::print("<div class=\"gd-table-wrap\">");
314318
fmt::print("<table class=\"gd-ankisearch-table\">\n");
315319
print_table_header(params);
316320
for (auto const& card: get_cids_info(cids) | std::views::transform(card_json_to_obj)) {
@@ -328,7 +332,8 @@ void print_cards_info(search_params const& params)
328332
fmt::print("<td>{}</td>\n", get_note_tags(card.nid));
329333
fmt::print("</tr>\n");
330334
}
331-
fmt::print("</table>\n");
335+
fmt::print("</table>");
336+
fmt::print("</div>\n"); // gd-table-wrap
332337
fmt::print("{}\n", css_style);
333338
}
334339

0 commit comments

Comments
 (0)