-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrss-to-markdown.html
More file actions
62 lines (62 loc) · 1.79 KB
/
rss-to-markdown.html
File metadata and controls
62 lines (62 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>RSS to Markdown | tools.eliana.lol</title>
<link rel="stylesheet" href="global.css" />
<link rel="icon" type="image/x-icon" href="favicon.svg" />
</head>
<body>
<nav>
<div class="left">
<a href="index.html">home</a> | <a href="extra.html">extra</a> |
<a href="credits.html">credits</a> | <a href="changelog.html">logs</a>
</div>
<div class="right">
<button id="theme-toggle">[theme]</button> |
<a href="https://eliana.lol">site</a>
</div>
</nav>
<main>
<h1>RSS → Markdown</h1>
<input
type="url"
id="feedUrl"
placeholder="Feed URL..."
style="
width: 100%;
padding: 10px;
background: var(--bg);
color: var(--text);
border: 1px solid var(--puny);
"
/>
<button
onclick="toMD()"
style="border-color: var(--accent); margin-top: 10px"
>
Convert
</button>
<textarea
id="mdOut"
rows="15"
style="margin-top: 20px; background: var(--hover); color: var(--accent)"
></textarea>
</main>
<script>
async function toMD() {
const url = document.getElementById('feedUrl').value;
const res = await fetch(
`https://corsproxy.io/?url=${encodeURIComponent(url)}`
);
const text = await res.text();
const doc = new DOMParser().parseFromString(text, 'text/xml');
let md = '';
doc.querySelectorAll('item').forEach((i) => {
md += `- [${i.querySelector('title').textContent}](${i.querySelector('link').textContent})\n`;
});
document.getElementById('mdOut').value = md;
}
</script>
</body>
</html>