1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-23 22:36:32 +02:00

Tools: Add Open Graph tags to website

This commit is contained in:
Laurent Cozic
2022-02-24 19:35:28 +00:00
parent 0a1947a712
commit f0113c0673
12 changed files with 205 additions and 27 deletions

View File

@@ -15,8 +15,17 @@ export class MarkupLanguageUtils {
throw new Error(`Unsupported markup language: ${language}`);
}
public extractImageUrls(language: MarkupLanguage, text: string) {
return this.lib_(language).extractImageUrls(text);
public extractImageUrls(language: MarkupLanguage, text: string): string[] {
let urls: string[] = [];
if (language === MarkupLanguage.Any) {
urls = urls.concat(this.lib_(MarkupLanguage.Markdown).extractImageUrls(text));
urls = urls.concat(this.lib_(MarkupLanguage.Html).extractImageUrls(text));
} else {
urls = this.lib_(language).extractImageUrls(text);
}
return urls;
}
// Create a new MarkupToHtml instance while injecting options specific to Joplin