Add remaining samples, tooling, and local project assets
This commit is contained in:
22
samples/src/lib/markdownUtils.js
Normal file
22
samples/src/lib/markdownUtils.js
Normal file
@@ -0,0 +1,22 @@
|
||||
// /src/utils/markdownUtils.js
|
||||
const imageCache = new Map();
|
||||
|
||||
export function resolveImagePath(src) {
|
||||
if (!src) return src;
|
||||
if (src.startsWith("@img/")) {
|
||||
return src.replace("@img/", "/civil-engineering-lab/images/");
|
||||
}
|
||||
if (src.startsWith("../assets/images/")) {
|
||||
return src.replace("../assets/images/", "/civil-engineering-lab/images/");
|
||||
}
|
||||
return src;
|
||||
}
|
||||
|
||||
/**
|
||||
* href가 외부 링크인지 확인
|
||||
* - http://, https://, // 로 시작하면 외부 링크로 판단
|
||||
*/
|
||||
export function isExternalLink(href) {
|
||||
if (!href) return false;
|
||||
return /^https?:\/\//.test(href) || href.startsWith("//");
|
||||
}
|
||||
Reference in New Issue
Block a user