@skrillex1224/chrome-article-publish-extension 1.0.7 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -166,24 +166,21 @@ type PublishRequest = {
166
166
 
167
167
  type PublishArticleInput = {
168
168
  title: string
169
+ markdown: string
169
170
  description?: string
170
- body?: string
171
- content?: string
172
- markdown?: string
173
- html?: string
174
171
  cover?: string
175
172
  tags?: string[]
176
- category?: string
177
173
  images?: Array<{ url: string }>
178
174
  video?: {
179
175
  url: string
180
176
  filename?: string
181
177
  mimeType?: string
182
178
  }
183
- source?: { url: string; platform: string }
184
179
  }
185
180
  ```
186
181
 
182
+ `markdown` is the only public article body format. Do not pass HTML. Adapters convert Markdown to the platform-specific HTML, Markdown, media caption, or rich-text payload internally.
183
+
187
184
  For Douyin image-text, pass `platform: 'douyin'` and `article.images: [{ url }]`. The adapter uploads those image URLs through ImageX and publishes a note. Douyin image-text no longer converts Markdown into image cards.
188
185
 
189
186
  For Douyin video, pass `platform: 'douyin'` and `article.video.url`. The adapter runs inside a logged-in Chrome extension context, uses the official Creator page uploader for the video asset, and then calls the Creator publish API. If `article.cover` is present, the adapter uploads it as the video cover; otherwise it uses the platform-generated poster from the uploaded video.
@@ -1,6 +1,6 @@
1
- import { P as PlatformAdapter, a as PublishOptions, A as AdapterRegistryEntry, b as PreprocessConfig } from '../types-CTtvGuEx.js';
2
- export { C as Category, D as DEFAULT_PREPROCESS_CONFIG, c as Draft, I as ImageProgressCallback, O as OutputFormat } from '../types-CTtvGuEx.js';
3
- import { P as PlatformMeta, R as RuntimeInterface, A as AuthResult, a as Article, S as SyncResult, c as PublishStatusRef, d as PublishStatusResult, H as HeaderRule } from '../interface-CLQqUboy.js';
1
+ import { P as PlatformAdapter, a as PublishOptions, A as AdapterRegistryEntry } from '../types-CwD2heJM.js';
2
+ export { C as Category, D as Draft, I as ImageProgressCallback } from '../types-CwD2heJM.js';
3
+ import { P as PlatformMeta, R as RuntimeInterface, A as AuthResult, a as Article, S as SyncResult, c as PublishStatusRef, d as PublishStatusResult, H as HeaderRule } from '../interface-D94XUord.js';
4
4
 
5
5
  /**
6
6
  * 适配器基类
@@ -35,21 +35,15 @@ declare abstract class BaseAdapter implements PlatformAdapter {
35
35
  * 代码适配器基类
36
36
  *
37
37
  * 架构说明:
38
- * - Content Script (有 DOM): 负责所有 HTML/DOM 处理
39
- * - 代码块处理 (使用 innerText)
40
- * - 懒加载图片处理
41
- * - HTML 转 Markdown
42
- * - Service Worker (无 DOM): 只负责 API 调用
43
- * - 接收已处理好的 html 和 markdown
44
- * - 图片上传 (URL 替换,不需要 DOM)
45
- * - 调用平台 API
38
+ * - 调用方只提供 markdown 作为正文输入
39
+ * - 适配器负责把 markdown 转成平台需要的 HTML、Markdown 或富文本 payload
40
+ * - 图片上传在适配器内做 URL 替换,不依赖调用方预处理内容
46
41
  *
47
42
  * 适配器接收的 Article 对象:
48
- * - article.html: 已预处理的 HTML (代码块已简化,图片已处理)
49
- * - article.markdown: 已转换的 Markdown
43
+ * - article.markdown: 规范正文输入
50
44
  *
51
45
  * 适配器只需:
52
- * 1. 选择使用 html 还是 markdown
46
+ * 1. 生成平台需要的正文格式
53
47
  * 2. 处理图片上传 (如果平台需要)
54
48
  * 3. 调用平台 API
55
49
  */
@@ -213,14 +207,6 @@ declare class AdapterRegistry {
213
207
  * 清空注册
214
208
  */
215
209
  clear(): void;
216
- /**
217
- * 获取平台的预处理配置
218
- */
219
- getPreprocessConfig(platformId: string): PreprocessConfig;
220
- /**
221
- * 获取多个平台的预处理配置
222
- */
223
- getPreprocessConfigs(platformIds: string[]): Record<string, PreprocessConfig>;
224
210
  }
225
211
  /**
226
212
  * 全局适配器注册中心实例
@@ -234,14 +220,6 @@ declare function registerAdapter(entry: AdapterRegistryEntry): void;
234
220
  * 获取适配器的便捷函数
235
221
  */
236
222
  declare function getAdapter(platformId: string): Promise<PlatformAdapter | null>;
237
- /**
238
- * 获取平台的预处理配置
239
- */
240
- declare function getPreprocessConfig(platformId: string): PreprocessConfig;
241
- /**
242
- * 获取多个平台的预处理配置
243
- */
244
- declare function getPreprocessConfigs(platformIds: string[]): Record<string, PreprocessConfig>;
245
223
 
246
224
  /**
247
225
  * 豆瓣适配器
@@ -249,10 +227,6 @@ declare function getPreprocessConfigs(platformIds: string[]): Record<string, Pre
249
227
 
250
228
  declare class DoubanAdapter extends CodeAdapter {
251
229
  readonly meta: PlatformMeta;
252
- /** 预处理配置: 豆瓣使用 Markdown 格式 (转换为 Draft.js) */
253
- readonly preprocessConfig: {
254
- outputFormat: "markdown";
255
- };
256
230
  private username;
257
231
  private avatar;
258
232
  private formData;
@@ -273,13 +247,6 @@ declare class DoubanAdapter extends CodeAdapter {
273
247
 
274
248
  declare class XueqiuAdapter extends CodeAdapter {
275
249
  readonly meta: PlatformMeta;
276
- /** 预处理配置: 雪球使用 Markdown 格式 */
277
- readonly preprocessConfig: {
278
- outputFormat: "markdown";
279
- removeSpecialTags: boolean;
280
- removeSpecialTagsWithParent: boolean;
281
- processCodeBlocks: boolean;
282
- };
283
250
  private currentUser;
284
251
  /** 雪球 API 需要的 Header 规则 */
285
252
  private readonly HEADER_RULES;
@@ -297,10 +264,6 @@ declare class XueqiuAdapter extends CodeAdapter {
297
264
 
298
265
  declare class SohuAdapter extends CodeAdapter {
299
266
  readonly meta: PlatformMeta;
300
- /** 预处理配置: 搜狐号使用 HTML 格式 */
301
- readonly preprocessConfig: {
302
- outputFormat: "html";
303
- };
304
267
  private accountInfo;
305
268
  private deviceId;
306
269
  private spCm;
@@ -329,11 +292,6 @@ declare class SohuAdapter extends CodeAdapter {
329
292
 
330
293
  declare class WoshipmAdapter extends CodeAdapter {
331
294
  readonly meta: PlatformMeta;
332
- /** 预处理配置: 人人都是产品经理使用 HTML 格式 */
333
- readonly preprocessConfig: {
334
- outputFormat: "html";
335
- removeEmptyLines: boolean;
336
- };
337
295
  private jltoken;
338
296
  /** 人人都是产品经理 API 需要的 Header 规则 */
339
297
  private readonly HEADER_RULES;
@@ -363,10 +321,6 @@ declare class WoshipmAdapter extends CodeAdapter {
363
321
 
364
322
  declare class JuejinAdapter extends CodeAdapter {
365
323
  readonly meta: PlatformMeta;
366
- /** 预处理配置: 掘金使用 Markdown 格式 */
367
- readonly preprocessConfig: {
368
- outputFormat: "markdown";
369
- };
370
324
  private cachedCsrfToken;
371
325
  private cachedImageXToken;
372
326
  private imageXTokenExpiry;
@@ -433,10 +387,6 @@ declare class JuejinAdapter extends CodeAdapter {
433
387
 
434
388
  declare class CSDNAdapter extends CodeAdapter {
435
389
  readonly meta: PlatformMeta;
436
- /** 预处理配置: CSDN 使用 Markdown 格式 */
437
- readonly preprocessConfig: {
438
- outputFormat: "markdown";
439
- };
440
390
  private userInfo;
441
391
  private readonly API_KEY;
442
392
  private readonly API_SECRET;
@@ -486,11 +436,6 @@ declare class CSDNAdapter extends CodeAdapter {
486
436
 
487
437
  declare class BilibiliAdapter extends CodeAdapter {
488
438
  readonly meta: PlatformMeta;
489
- /** 预处理配置: B站使用 HTML,移除外链 */
490
- readonly preprocessConfig: {
491
- outputFormat: "html";
492
- removeLinks: boolean;
493
- };
494
439
  private userInfo;
495
440
  private csrf;
496
441
  private wbiKeys;
@@ -504,7 +449,6 @@ declare class BilibiliAdapter extends CodeAdapter {
504
449
  private findDynamicInSpaceFeed;
505
450
  private mapDynamicStatus;
506
451
  private createOpusPayload;
507
- private contentToOpusContent;
508
452
  private markdownToOpusContent;
509
453
  private markdownTokenToParagraphs;
510
454
  private inlineParagraphs;
@@ -569,14 +513,6 @@ declare class BilibiliAdapter extends CodeAdapter {
569
513
 
570
514
  declare class DouyinAdapter extends CodeAdapter {
571
515
  readonly meta: PlatformMeta;
572
- readonly preprocessConfig: {
573
- outputFormat: "html";
574
- removeLinks: boolean;
575
- removeIframes: boolean;
576
- removeComments: boolean;
577
- processLazyImages: boolean;
578
- convertTablesToText: boolean;
579
- };
580
516
  private userInfo;
581
517
  private cachedImageXToken;
582
518
  private activePublishOptions;
@@ -654,10 +590,6 @@ declare class DouyinAdapter extends CodeAdapter {
654
590
 
655
591
  declare class BaijiahaoAdapter extends CodeAdapter {
656
592
  readonly meta: PlatformMeta;
657
- /** 预处理配置: 百家号使用 HTML 格式 */
658
- readonly preprocessConfig: {
659
- outputFormat: "html";
660
- };
661
593
  private userInfo;
662
594
  private authToken;
663
595
  /** 百家号 API 需要的 Header 规则 */
@@ -694,13 +626,6 @@ declare class BaijiahaoAdapter extends CodeAdapter {
694
626
 
695
627
  declare class YuqueAdapter extends CodeAdapter {
696
628
  readonly meta: PlatformMeta;
697
- /** 预处理配置: 语雀使用 Markdown 格式 (转换为 lake) */
698
- readonly preprocessConfig: {
699
- outputFormat: "markdown";
700
- removeSpecialTags: boolean;
701
- removeSpecialTagsWithParent: boolean;
702
- processCodeBlocks: boolean;
703
- };
704
629
  private userInfo;
705
630
  private bookId;
706
631
  private csrfToken;
@@ -724,13 +649,6 @@ interface WeixinImageUploadResult extends ImageUploadResult {
724
649
  }
725
650
  declare class WeixinAdapter extends CodeAdapter {
726
651
  readonly meta: PlatformMeta;
727
- /** 预处理配置: 微信公众号使用 HTML 格式,移除非微信域名链接,压缩标签间空白避免 ProseMirror 产生空节点 */
728
- readonly preprocessConfig: {
729
- outputFormat: "html";
730
- removeLinks: boolean;
731
- keepLinkDomains: string[];
732
- compactHtml: boolean;
733
- };
734
652
  private weixinMeta;
735
653
  private authUrl;
736
654
  /** 微信公众号 API 需要的 Header 规则 */
@@ -764,7 +682,6 @@ declare class WeixinAdapter extends CodeAdapter {
764
682
  private extractWxCommonData;
765
683
  private extractCommonDataField;
766
684
  private extractTokenFromUrl;
767
- private loadTokenFromSourceUrl;
768
685
  protected uploadImageByUrl(src: string): Promise<WeixinImageUploadResult>;
769
686
  private buildCoverCropList;
770
687
  private centerCrop;
@@ -795,12 +712,6 @@ declare class WeixinAdapter extends CodeAdapter {
795
712
 
796
713
  declare class ToutiaoAdapter extends CodeAdapter {
797
714
  readonly meta: PlatformMeta;
798
- readonly preprocessConfig: {
799
- outputFormat: "html";
800
- removeLinks: boolean;
801
- removeIframes: boolean;
802
- removeSvgImages: boolean;
803
- };
804
715
  private readonly HEADER_RULES;
805
716
  checkAuth(): Promise<AuthResult>;
806
717
  publish(article: Article, options?: PublishOptions): Promise<SyncResult>;
@@ -834,9 +745,6 @@ interface TencentImageUploadResult extends ImageUploadResult {
834
745
  }
835
746
  declare class TencentAdapter extends CodeAdapter {
836
747
  readonly meta: PlatformMeta;
837
- readonly preprocessConfig: {
838
- outputFormat: "html";
839
- };
840
748
  private userInfo;
841
749
  private readonly HEADER_RULES;
842
750
  checkAuth(): Promise<AuthResult>;
@@ -872,10 +780,6 @@ declare class TencentAdapter extends CodeAdapter {
872
780
 
873
781
  declare class Cto51Adapter extends CodeAdapter {
874
782
  meta: PlatformMeta;
875
- /** 预处理配置: 51CTO 使用 Markdown 格式 */
876
- readonly preprocessConfig: {
877
- outputFormat: "markdown";
878
- };
879
783
  private csrf;
880
784
  private userPath;
881
785
  private category;
@@ -924,10 +828,6 @@ declare class Cto51Adapter extends CodeAdapter {
924
828
 
925
829
  declare class ImoocAdapter extends CodeAdapter {
926
830
  meta: PlatformMeta;
927
- /** 预处理配置: 慕课网使用 Markdown 格式 */
928
- readonly preprocessConfig: {
929
- outputFormat: "markdown";
930
- };
931
831
  /** 慕课网 API 需要的 Header 规则 */
932
832
  private readonly HEADER_RULES;
933
833
  /**
@@ -951,10 +851,6 @@ declare class ImoocAdapter extends CodeAdapter {
951
851
 
952
852
  declare class OschinaAdapter extends CodeAdapter {
953
853
  meta: PlatformMeta;
954
- /** 预处理配置: 开源中国使用 Markdown 格式 */
955
- readonly preprocessConfig: {
956
- outputFormat: "markdown";
957
- };
958
854
  private userId;
959
855
  /** 开源中国 API 需要的 Header 规则 */
960
856
  private readonly HEADER_RULES;
@@ -980,10 +876,6 @@ declare class OschinaAdapter extends CodeAdapter {
980
876
 
981
877
  declare class SegmentfaultAdapter extends CodeAdapter {
982
878
  meta: PlatformMeta;
983
- /** 预处理配置: 思否使用 Markdown 格式 */
984
- readonly preprocessConfig: {
985
- outputFormat: "markdown";
986
- };
987
879
  private sessionToken;
988
880
  /** 思否 API 需要的 Header 规则 */
989
881
  private readonly HEADER_RULES;
@@ -1011,10 +903,6 @@ declare class SegmentfaultAdapter extends CodeAdapter {
1011
903
 
1012
904
  declare class CnblogsAdapter extends CodeAdapter {
1013
905
  readonly meta: PlatformMeta;
1014
- /** 预处理配置: 博客园使用 Markdown 格式 */
1015
- readonly preprocessConfig: {
1016
- outputFormat: "markdown";
1017
- };
1018
906
  private xsrfToken;
1019
907
  /** 博客园 API 需要的 Header 规则 */
1020
908
  private readonly HEADER_RULES;
@@ -1077,24 +965,6 @@ declare class ZipDownloadAdapter extends CodeAdapter {
1077
965
 
1078
966
  declare class EastmoneyAdapter extends CodeAdapter {
1079
967
  readonly meta: PlatformMeta;
1080
- /** 预处理配置 */
1081
- readonly preprocessConfig: {
1082
- outputFormat: "html";
1083
- removeComments: boolean;
1084
- removeSpecialTags: boolean;
1085
- processCodeBlocks: boolean;
1086
- convertSectionToDiv: boolean;
1087
- removeEmptyLines: boolean;
1088
- removeEmptyDivs: boolean;
1089
- removeNestedEmptyContainers: boolean;
1090
- unwrapSingleChildContainers: boolean;
1091
- unwrapNestedFigures: boolean;
1092
- removeTrailingBr: boolean;
1093
- removeDataAttributes: boolean;
1094
- removeSrcset: boolean;
1095
- removeSizes: boolean;
1096
- compactHtml: boolean;
1097
- };
1098
968
  private ctoken;
1099
969
  private utoken;
1100
970
  private deviceId;
@@ -1124,10 +994,6 @@ declare class EastmoneyAdapter extends CodeAdapter {
1124
994
 
1125
995
  declare class NeteaseAdapter extends CodeAdapter {
1126
996
  readonly meta: PlatformMeta;
1127
- readonly preprocessConfig: {
1128
- outputFormat: "html";
1129
- convertTablesToText: boolean;
1130
- };
1131
997
  private accountInfo;
1132
998
  private readonly HEADER_RULES;
1133
999
  checkAuth(): Promise<AuthResult>;
@@ -1154,4 +1020,4 @@ declare class NeteaseAdapter extends CodeAdapter {
1154
1020
  private isPublicArticleAvailable;
1155
1021
  }
1156
1022
 
1157
- export { AdapterRegistryEntry, BaijiahaoAdapter, BaseAdapter, BilibiliAdapter, CSDNAdapter, CnblogsAdapter, CodeAdapter, Cto51Adapter, DoubanAdapter, DouyinAdapter, EastmoneyAdapter, type ImageProcessOptions, type ImageUploadResult, ImoocAdapter, JuejinAdapter, NeteaseAdapter, type NormalizedImageFile, OschinaAdapter, PlatformAdapter, PreprocessConfig, PublishOptions, SegmentfaultAdapter, SohuAdapter, TencentAdapter, ToutiaoAdapter, WeixinAdapter, WoshipmAdapter, XueqiuAdapter, YuqueAdapter, ZipDownloadAdapter, adapterRegistry, getAdapter, getPreprocessConfig, getPreprocessConfigs, registerAdapter };
1023
+ export { AdapterRegistryEntry, BaijiahaoAdapter, BaseAdapter, BilibiliAdapter, CSDNAdapter, CnblogsAdapter, CodeAdapter, Cto51Adapter, DoubanAdapter, DouyinAdapter, EastmoneyAdapter, type ImageProcessOptions, type ImageUploadResult, ImoocAdapter, JuejinAdapter, NeteaseAdapter, type NormalizedImageFile, OschinaAdapter, PlatformAdapter, PublishOptions, SegmentfaultAdapter, SohuAdapter, TencentAdapter, ToutiaoAdapter, WeixinAdapter, WoshipmAdapter, XueqiuAdapter, YuqueAdapter, ZipDownloadAdapter, adapterRegistry, getAdapter, registerAdapter };
@@ -13,24 +13,9 @@ import {
13
13
  ToutiaoAdapter,
14
14
  WeixinAdapter,
15
15
  createLogger,
16
- htmlToMarkdown,
16
+ markdownToHtml,
17
17
  parseMarkdownImages
18
- } from "../chunk-NERXWCKG.js";
19
-
20
- // src/adapters/types.ts
21
- var DEFAULT_PREPROCESS_CONFIG = {
22
- outputFormat: "html",
23
- removeIframes: true,
24
- removeComments: true,
25
- removeSpecialTags: true,
26
- removeSvgImages: true,
27
- processCodeBlocks: true,
28
- processLazyImages: true,
29
- removeEmptyElements: true,
30
- removeDataAttributes: true,
31
- removeSrcset: true,
32
- removeSizes: true
33
- };
18
+ } from "../chunk-CWVD3IOG.js";
34
19
 
35
20
  // src/adapters/base.ts
36
21
  var BaseAdapter = class {
@@ -163,26 +148,6 @@ var AdapterRegistry = class {
163
148
  this.adapters.clear();
164
149
  this.instances.clear();
165
150
  }
166
- /**
167
- * 获取平台的预处理配置
168
- */
169
- getPreprocessConfig(platformId) {
170
- const entry = this.adapters.get(platformId);
171
- return {
172
- ...DEFAULT_PREPROCESS_CONFIG,
173
- ...entry?.preprocessConfig || {}
174
- };
175
- }
176
- /**
177
- * 获取多个平台的预处理配置
178
- */
179
- getPreprocessConfigs(platformIds) {
180
- const configs = {};
181
- for (const id of platformIds) {
182
- configs[id] = this.getPreprocessConfig(id);
183
- }
184
- return configs;
185
- }
186
151
  };
187
152
  var adapterRegistry = new AdapterRegistry();
188
153
  function registerAdapter(entry) {
@@ -191,12 +156,6 @@ function registerAdapter(entry) {
191
156
  async function getAdapter(platformId) {
192
157
  return adapterRegistry.get(platformId);
193
158
  }
194
- function getPreprocessConfig(platformId) {
195
- return adapterRegistry.getPreprocessConfig(platformId);
196
- }
197
- function getPreprocessConfigs(platformIds) {
198
- return adapterRegistry.getPreprocessConfigs(platformIds);
199
- }
200
159
 
201
160
  // src/lib/markdown-to-draft.ts
202
161
  import { markdownToDraft as mdToDraft } from "markdown-draft-js";
@@ -327,10 +286,6 @@ var DoubanAdapter = class extends CodeAdapter {
327
286
  homepage: "https://www.douban.com/note/create",
328
287
  capabilities: ["article", "draft", "image_upload"]
329
288
  };
330
- /** 预处理配置: 豆瓣使用 Markdown 格式 (转换为 Draft.js) */
331
- preprocessConfig = {
332
- outputFormat: "markdown"
333
- };
334
289
  username = "";
335
290
  avatar = "";
336
291
  formData = null;
@@ -514,14 +469,6 @@ var XueqiuAdapter = class extends CodeAdapter {
514
469
  homepage: "https://mp.xueqiu.com/writeV2",
515
470
  capabilities: ["article", "draft", "image_upload"]
516
471
  };
517
- /** 预处理配置: 雪球使用 Markdown 格式 */
518
- preprocessConfig = {
519
- outputFormat: "markdown",
520
- // doPreFilter + processDocCode (旧版)
521
- removeSpecialTags: true,
522
- removeSpecialTagsWithParent: true,
523
- processCodeBlocks: true
524
- };
525
472
  currentUser = null;
526
473
  /** 雪球 API 需要的 Header 规则 */
527
474
  HEADER_RULES = [
@@ -691,11 +638,6 @@ var WoshipmAdapter = class extends CodeAdapter {
691
638
  homepage: "https://www.woshipm.com",
692
639
  capabilities: ["article", "draft", "image_upload"]
693
640
  };
694
- /** 预处理配置: 人人都是产品经理使用 HTML 格式 */
695
- preprocessConfig = {
696
- outputFormat: "html",
697
- removeEmptyLines: true
698
- };
699
641
  jltoken = "";
700
642
  /** 人人都是产品经理 API 需要的 Header 规则 */
701
643
  HEADER_RULES = [
@@ -760,7 +702,7 @@ var WoshipmAdapter = class extends CodeAdapter {
760
702
  async publish(article, options) {
761
703
  return this.withHeaderRules(this.HEADER_RULES, async () => {
762
704
  logger3.info("Starting publish...");
763
- let content = article.html || "";
705
+ let content = markdownToHtml(article.markdown);
764
706
  content = await this.processImages(
765
707
  content,
766
708
  (src) => this.uploadImageByUrl(src),
@@ -887,14 +829,6 @@ var YuqueAdapter = class extends CodeAdapter {
887
829
  homepage: "https://www.yuque.com/dashboard",
888
830
  capabilities: ["article", "draft", "image_upload"]
889
831
  };
890
- /** 预处理配置: 语雀使用 Markdown 格式 (转换为 lake) */
891
- preprocessConfig = {
892
- outputFormat: "markdown",
893
- // doPreFilter + processDocCode (旧版)
894
- removeSpecialTags: true,
895
- removeSpecialTagsWithParent: true,
896
- processCodeBlocks: true
897
- };
898
832
  userInfo = null;
899
833
  bookId = null;
900
834
  csrfToken = "";
@@ -1088,10 +1022,6 @@ var ImoocAdapter = class extends CodeAdapter {
1088
1022
  homepage: "https://www.imooc.com/article",
1089
1023
  capabilities: ["article", "draft", "image_upload"]
1090
1024
  };
1091
- /** 预处理配置: 慕课网使用 Markdown 格式 */
1092
- preprocessConfig = {
1093
- outputFormat: "markdown"
1094
- };
1095
1025
  /** 慕课网 API 需要的 Header 规则 */
1096
1026
  HEADER_RULES = [
1097
1027
  {
@@ -1164,7 +1094,7 @@ var ImoocAdapter = class extends CodeAdapter {
1164
1094
  async publish(article) {
1165
1095
  const now = Date.now();
1166
1096
  return this.withHeaderRules(this.HEADER_RULES, async () => {
1167
- let content = article.markdown || article.html || "";
1097
+ let content = article.markdown;
1168
1098
  content = await this.processImages(content, (src) => this.uploadImageByUrl(src));
1169
1099
  const response = await this.runtime.fetch("https://www.imooc.com/article/savedraft", {
1170
1100
  method: "POST",
@@ -1208,10 +1138,6 @@ var OschinaAdapter = class extends CodeAdapter {
1208
1138
  homepage: "https://my.oschina.net",
1209
1139
  capabilities: ["article", "draft", "image_upload"]
1210
1140
  };
1211
- /** 预处理配置: 开源中国使用 Markdown 格式 */
1212
- preprocessConfig = {
1213
- outputFormat: "markdown"
1214
- };
1215
1141
  userId = null;
1216
1142
  /** 开源中国 API 需要的 Header 规则 */
1217
1143
  HEADER_RULES = [
@@ -1294,10 +1220,7 @@ var OschinaAdapter = class extends CodeAdapter {
1294
1220
  throw new Error("\u672A\u767B\u5F55");
1295
1221
  }
1296
1222
  }
1297
- const rawMarkdown = article.markdown || "";
1298
- const rawHtml = article.html || "";
1299
- const useMarkdown = rawMarkdown.trim().length > 0;
1300
- let content = useMarkdown ? rawMarkdown : rawHtml;
1223
+ let content = article.markdown;
1301
1224
  content = await this.processImages(content, (src) => this.uploadImageByUrl(src));
1302
1225
  const response = await this.runtime.fetch(
1303
1226
  "https://apiv1.oschina.net/oschinapi/api/draft/save_draft",
@@ -1311,8 +1234,8 @@ var OschinaAdapter = class extends CodeAdapter {
1311
1234
  title: article.title,
1312
1235
  user: Number(this.userId),
1313
1236
  content,
1314
- contentType: useMarkdown ? 1 : 2,
1315
- // 1=markdown, 2=html
1237
+ contentType: 1,
1238
+ // 1=markdown
1316
1239
  catalog: 0,
1317
1240
  originUrl: "",
1318
1241
  privacy: true,
@@ -1350,10 +1273,6 @@ var SegmentfaultAdapter = class extends CodeAdapter {
1350
1273
  homepage: "https://segmentfault.com/user/draft",
1351
1274
  capabilities: ["article", "draft", "image_upload"]
1352
1275
  };
1353
- /** 预处理配置: 思否使用 Markdown 格式 */
1354
- preprocessConfig = {
1355
- outputFormat: "markdown"
1356
- };
1357
1276
  sessionToken = null;
1358
1277
  /** 思否 API 需要的 Header 规则 */
1359
1278
  HEADER_RULES = [
@@ -1470,7 +1389,7 @@ var SegmentfaultAdapter = class extends CodeAdapter {
1470
1389
  const now = Date.now();
1471
1390
  return this.withHeaderRules(this.HEADER_RULES, async () => {
1472
1391
  this.sessionToken = await this.getSessionToken();
1473
- let content = article.markdown || article.html || "";
1392
+ let content = article.markdown;
1474
1393
  content = await this.processImages(content, (src) => this.uploadImageByUrl(src));
1475
1394
  const postData = {
1476
1395
  title: article.title,
@@ -1561,7 +1480,7 @@ var ZipDownloadAdapter = class extends CodeAdapter {
1561
1480
  try {
1562
1481
  const zip = new JSZip();
1563
1482
  const imgFolder = zip.folder("images");
1564
- let markdown = article.markdown || htmlToMarkdown(article.html || "");
1483
+ let markdown = article.markdown;
1565
1484
  if (!markdown.trim()) {
1566
1485
  return this.createResult(false, {
1567
1486
  error: "\u6587\u7AE0\u5185\u5BB9\u4E3A\u7A7A"
@@ -1719,24 +1638,6 @@ var EastmoneyAdapter = class extends CodeAdapter {
1719
1638
  homepage: "https://mp.eastmoney.com",
1720
1639
  capabilities: ["article", "draft", "image_upload", "cover"]
1721
1640
  };
1722
- /** 预处理配置 */
1723
- preprocessConfig = {
1724
- outputFormat: "html",
1725
- removeComments: true,
1726
- removeSpecialTags: true,
1727
- processCodeBlocks: true,
1728
- convertSectionToDiv: true,
1729
- removeEmptyLines: true,
1730
- removeEmptyDivs: true,
1731
- removeNestedEmptyContainers: true,
1732
- unwrapSingleChildContainers: true,
1733
- unwrapNestedFigures: true,
1734
- removeTrailingBr: true,
1735
- removeDataAttributes: true,
1736
- removeSrcset: true,
1737
- removeSizes: true,
1738
- compactHtml: true
1739
- };
1740
1641
  ctoken = "";
1741
1642
  utoken = "";
1742
1643
  deviceId = "";
@@ -1811,7 +1712,7 @@ var EastmoneyAdapter = class extends CodeAdapter {
1811
1712
  const draftId = await this.createDraft(article.title);
1812
1713
  logger6.debug("Draft created:", draftId);
1813
1714
  const content = await this.processImages(
1814
- article.html || "",
1715
+ markdownToHtml(article.markdown),
1815
1716
  (src) => this.uploadImageByUrl(src),
1816
1717
  {
1817
1718
  skipPatterns: ["gbres.dfcfw.com"],
@@ -1988,7 +1889,6 @@ export {
1988
1889
  CnblogsAdapter,
1989
1890
  CodeAdapter,
1990
1891
  Cto51Adapter,
1991
- DEFAULT_PREPROCESS_CONFIG,
1992
1892
  DoubanAdapter,
1993
1893
  DouyinAdapter,
1994
1894
  EastmoneyAdapter,
@@ -2007,8 +1907,6 @@ export {
2007
1907
  ZipDownloadAdapter,
2008
1908
  adapterRegistry,
2009
1909
  getAdapter,
2010
- getPreprocessConfig,
2011
- getPreprocessConfigs,
2012
1910
  registerAdapter
2013
1911
  };
2014
1912
  //# sourceMappingURL=index.js.map