···
1928
+
// Academic paper detection - PDF files and academic domains
1930
+
link.url.toLowerCase().endsWith('.pdf') ||
1931
+
url.hostname.includes('arxiv.org') ||
1932
+
url.hostname.includes('nature.com') ||
1933
+
url.hostname.includes('science.org') ||
1934
+
url.hostname.includes('mdpi.com')
1936
+
// Set display text based on source
1937
+
if (url.hostname.includes('arxiv.org')) {
1938
+
// Try to extract arXiv ID
1939
+
const arxivIdMatch = url.pathname.match(/\d+\.\d+/);
1940
+
if (arxivIdMatch) {
1941
+
displayText = `<img src="free-icons/svgs/regular-file-pdf.svg" width="14" height="14" style="vertical-align: middle; margin-right: 4px;"> ${arxivIdMatch[0]}`;
1943
+
displayText = `<img src="free-icons/svgs/regular-file-pdf.svg" width="14" height="14" style="vertical-align: middle; margin-right: 4px;"> Paper`;
1945
+
} else if (url.hostname.includes('nature.com')) {
1946
+
displayText = `<img src="free-icons/svgs/regular-file-pdf.svg" width="14" height="14" style="vertical-align: middle; margin-right: 4px;"> Paper`;
1947
+
} else if (url.hostname.includes('science.org')) {
1948
+
displayText = `<img src="free-icons/svgs/regular-file-pdf.svg" width="14" height="14" style="vertical-align: middle; margin-right: 4px;"> Paper`;
1949
+
} else if (url.hostname.includes('mdpi.com')) {
1950
+
displayText = `<img src="free-icons/svgs/regular-file-pdf.svg" width="14" height="14" style="vertical-align: middle; margin-right: 4px;"> Paper`;
1951
+
} else if (link.url.toLowerCase().endsWith('.pdf')) {
1952
+
// For direct PDF links, try to get a meaningful filename
1953
+
const pathParts = url.pathname.split('/');
1954
+
const filename = pathParts[pathParts.length - 1];
1956
+
displayText = `<img src="free-icons/svgs/regular-file-pdf.svg" width="14" height="14" style="vertical-align: middle; margin-right: 4px;"> ${decodeURIComponent(filename)}`;
1958
+
displayText = `<img src="free-icons/svgs/regular-file-pdf.svg" width="14" height="14" style="vertical-align: middle; margin-right: 4px;"> Document`;
// Determine link type for styling and future reference
if (url.hostname.includes('github')) linkType = 'github';
···
else if (url.hostname.includes('news.ycombinator.com')) linkType = 'hackernews';
else if (url.hostname === 'bsky.app' || url.hostname === 'bsky.social') linkType = 'bluesky';
else if (url.hostname === 'ocaml.org' && url.pathname.startsWith('/p/')) linkType = 'ocaml';
1978
+
link.url.toLowerCase().endsWith('.pdf') ||
1979
+
url.hostname.includes('arxiv.org') ||
1980
+
url.hostname.includes('nature.com') ||
1981
+
url.hostname.includes('science.org') ||
1982
+
url.hostname.includes('mdpi.com')
1983
+
) linkType = 'academic';
return `<a href="${link.url}" target="_blank" class="external-link-item" title="${link.url}" data-link-type="${linkType}">${displayText}</a>`;
···
displayText = `@${parts[0]}`;
2339
+
// Academic paper detection - PDF files and academic domains
2341
+
link.url.toLowerCase().endsWith('.pdf') ||
2342
+
url.hostname.includes('arxiv.org') ||
2343
+
url.hostname.includes('nature.com') ||
2344
+
url.hostname.includes('science.org') ||
2345
+
url.hostname.includes('mdpi.com')
2347
+
iconPath = 'free-icons/svgs/regular-file-pdf.svg';
2349
+
// Set display text based on source
2350
+
if (url.hostname.includes('arxiv.org')) {
2351
+
// Try to extract arXiv ID
2352
+
const arxivIdMatch = url.pathname.match(/\d+\.\d+/);
2353
+
if (arxivIdMatch) {
2354
+
displayText = arxivIdMatch[0];
2356
+
displayText = 'Paper';
2358
+
} else if (url.hostname.includes('nature.com')) {
2359
+
displayText = 'Paper';
2360
+
} else if (url.hostname.includes('science.org')) {
2361
+
displayText = 'Paper';
2362
+
} else if (url.hostname.includes('mdpi.com')) {
2363
+
displayText = 'Paper';
2364
+
} else if (link.url.toLowerCase().endsWith('.pdf')) {
2365
+
// For direct PDF links, try to get a meaningful filename
2366
+
const pathParts = url.pathname.split('/');
2367
+
const filename = pathParts[pathParts.length - 1];
2369
+
displayText = decodeURIComponent(filename);
2371
+
displayText = 'Document';