@getguru/import-engine 0.1.3 → 0.1.4

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.
Files changed (2) hide show
  1. package/docx-import-cli.js +35 -2
  2. package/package.json +1 -1
@@ -108512,6 +108512,12 @@ var card_schema_default = {
108512
108512
  strikethrough: {
108513
108513
  type: "boolean"
108514
108514
  },
108515
+ superscript: {
108516
+ type: "boolean"
108517
+ },
108518
+ subscript: {
108519
+ type: "boolean"
108520
+ },
108515
108521
  underline: {
108516
108522
  type: "boolean"
108517
108523
  },
@@ -111525,6 +111531,32 @@ var STYLE_ATTRIBUTES_TO_KEEP = [
111525
111531
  "text-align",
111526
111532
  "text-decoration"
111527
111533
  ];
111534
+ var VERTICAL_ALIGN_BLOCK_SELECTOR = "p, div, h1, h2, h3, h4, h5, h6, ul, ol, li, table, blockquote, pre";
111535
+ function convertVerticalAlignToTags(root2) {
111536
+ Array.from(root2.querySelectorAll("[style]")).forEach(function(el) {
111537
+ if (el.closest(".ghq-card-content__markdown")) {
111538
+ return;
111539
+ }
111540
+ const values2 = parseStyleString(el.getAttribute("style"));
111541
+ const key = Object.keys(values2).find((k) => k.toLowerCase() === "vertical-align");
111542
+ if (!key) {
111543
+ return;
111544
+ }
111545
+ const value = values2[key].replace(/!\s*important\s*$/i, "").trim().toLowerCase();
111546
+ if (value !== "super" && value !== "sub") {
111547
+ return;
111548
+ }
111549
+ const tagName = value === "super" ? "sup" : "sub";
111550
+ if (el.closest(tagName) || !el.textContent.trim() && !el.firstElementChild || el.querySelector(VERTICAL_ALIGN_BLOCK_SELECTOR)) {
111551
+ return;
111552
+ }
111553
+ const tag = el.ownerDocument.createElement(tagName);
111554
+ while (el.firstChild) {
111555
+ tag.appendChild(el.firstChild);
111556
+ }
111557
+ el.appendChild(tag);
111558
+ });
111559
+ }
111528
111560
  function parseStyleString(text2) {
111529
111561
  const result3 = {};
111530
111562
  const pairs3 = text2.split(";");
@@ -112110,6 +112142,7 @@ function cleanUpHtml(element, doc = {}) {
112110
112142
  );
112111
112143
  }
112112
112144
  });
112145
+ convertVerticalAlignToTags(element);
112113
112146
  Array.from(element.querySelectorAll("[style]")).forEach(function(element2) {
112114
112147
  if (element2.closest(".ghq-card-content__markdown")) {
112115
112148
  return;
@@ -114400,7 +114433,7 @@ var import_jszip5 = __toESM(require_lib3());
114400
114433
  var import_url_join6 = __toESM(require_url_join());
114401
114434
 
114402
114435
  // packages/import-engine/package.json
114403
- var version = "0.1.3";
114436
+ var version = "0.1.4";
114404
114437
 
114405
114438
  // src/docx-import/detectors.js
114406
114439
  function isGoogleSitesDoc(div) {
@@ -114424,7 +114457,7 @@ var showError;
114424
114457
  var updateLoader;
114425
114458
  var showReport;
114426
114459
  var docLinkIndex = /* @__PURE__ */ new Map();
114427
- var toolVersion = true ? `${version}+${"8671a17"}` : version;
114460
+ var toolVersion = true ? `${version}+${"b8fcb63"}` : version;
114428
114461
  var pendingUpload = null;
114429
114462
  function confirmPendingUpload() {
114430
114463
  const upload = pendingUpload;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getguru/import-engine",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Command-line engine that turns Notion, Confluence, Google, Word, PDF, Markdown and spreadsheet exports into Guru import zips.",
5
5
  "bin": {
6
6
  "guru-import-engine": "docx-import-cli.js"