feat: Initial clean release of CHM
一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
这个提交包含在:
@@ -0,0 +1,64 @@
|
||||
import markdownUtils from './markdownUtils';
|
||||
import Setting from './models/Setting';
|
||||
import shim from './shim';
|
||||
import MarkupToHtml, { Options } from '@joplin/renderer/MarkupToHtml';
|
||||
|
||||
import htmlUtils from './htmlUtils';
|
||||
import Resource from './models/Resource';
|
||||
import { PluginStates } from './services/plugins/reducer';
|
||||
import { MarkupLanguage } from '@joplin/renderer';
|
||||
|
||||
export class MarkupLanguageUtils {
|
||||
|
||||
private lib_(language: MarkupLanguage) {
|
||||
if (language === MarkupLanguage.Html) return htmlUtils;
|
||||
if (language === MarkupLanguage.Markdown) return markdownUtils;
|
||||
throw new Error(`Unsupported markup language: ${language}`);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public extractPdfUrls(language: MarkupLanguage, text: string): string[] {
|
||||
let urls: string[] = [];
|
||||
if (language === MarkupLanguage.Any) {
|
||||
urls = urls.concat(this.lib_(MarkupLanguage.Markdown).extractPdfUrls(text));
|
||||
urls = urls.concat(this.lib_(MarkupLanguage.Html).extractPdfUrls(text));
|
||||
} else {
|
||||
urls = this.lib_(language).extractPdfUrls(text);
|
||||
}
|
||||
return urls;
|
||||
}
|
||||
|
||||
// Create a new MarkupToHtml instance while injecting options specific to Joplin
|
||||
// desktop and mobile applications.
|
||||
public newMarkupToHtml(_plugins: PluginStates = null, options: Options = null) {
|
||||
const subValues = Setting.subValues('markdown.plugin', Setting.toPlainObject());
|
||||
const pluginOptions: Record<string, { enabled: boolean }> = {};
|
||||
for (const n in subValues) {
|
||||
pluginOptions[n] = { enabled: !!subValues[n] };
|
||||
}
|
||||
|
||||
options = { ResourceModel: Resource,
|
||||
pluginOptions: pluginOptions,
|
||||
tempDir: Setting.value('tempDir'),
|
||||
fsDriver: shim.fsDriver(),
|
||||
isSafeMode: Setting.value('isSafeMode'), ...options };
|
||||
|
||||
return new MarkupToHtml(options);
|
||||
}
|
||||
}
|
||||
|
||||
const markupLanguageUtils = new MarkupLanguageUtils();
|
||||
|
||||
export default markupLanguageUtils;
|
||||
在新工单中引用
屏蔽一个用户