Skip to content

Commit cb46814

Browse files
authored
Merge pull request #51 from tsugumi-sys/feat/code-syntax-highlight
feat: code syntax highlight
2 parents dc1dc33 + 05f76c0 commit cb46814

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

html/src/index.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ pub fn index_html(
1717
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
1818
<title>{owner_name} Blog</title>
1919
<link rel="stylesheet" href="{csv_file_path}">
20+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/themes/prism-tomorrow.min.css">
21+
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-core.min.js"></script>
22+
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/plugins/autoloader/prism-autoloader.min.js"></script>
23+
<script>
24+
// Load languages on demand from the CDN
25+
if (window.Prism && Prism.plugins.autoloader) {{
26+
Prism.plugins.autoloader.languages_path = "https://cdn.jsdelivr.net/npm/prismjs@1.29.0/components/";
27+
}}
28+
</script>
2029
{icon_html}
2130
</head>
2231
<body>
@@ -156,6 +165,7 @@ pub fn index_html(
156165
searchInput.addEventListener('input', doSearch);
157166
158167
initialize();
168+
Prism.highlightAll();
159169
</script>
160170
"#,
161171
);

html/src/post.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ pub fn post_html(
3434
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
3535
<title>{title}</title>
3636
<link rel="stylesheet" href="{css_file_path}">
37+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/themes/prism-tomorrow.min.css">
38+
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-core.min.js"></script>
39+
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/plugins/autoloader/prism-autoloader.min.js"></script>
40+
<script>
41+
// Load languages on demand from the CDN
42+
if (window.Prism && Prism.plugins.autoloader) {{
43+
Prism.plugins.autoloader.languages_path = "https://cdn.jsdelivr.net/npm/prismjs@1.29.0/components/";
44+
}}
45+
</script>
3746
{icon_html}
3847
</head>
3948
<body>
@@ -47,6 +56,7 @@ pub fn post_html(
4756
</main>
4857
</div>
4958
{footer_html}
59+
<script>Prism.highlightAll();</script>
5060
</body>
5161
</html>
5262
"#,

mejiro-cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mejiro-cli"
3-
version = "0.1.20"
3+
version = "0.1.21"
44
edition = "2024"
55
description = "A CLI tool for Mejiro"
66
license = "MIT OR Apache-2.0"

0 commit comments

Comments
 (0)