ochre-sdk 1.0.34 → 1.0.35

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.
@@ -47,7 +47,7 @@ function transformPermanentIdentificationUrl(url) {
47
47
  function parseRenderOptions(contentString, renderString, rendering) {
48
48
  const { success, output } = v.safeParse(renderOptionsSchema, renderString);
49
49
  if (!success) return contentString;
50
- if (rendering !== "rich") return contentString.replaceAll("'", "'");
50
+ if (rendering === "plain") return contentString.replaceAll("'", "'");
51
51
  return applyRichRenderOptions(contentString, output).replaceAll("'", "'");
52
52
  }
53
53
  function applyRichRenderOptions(contentString, options) {
@@ -263,11 +263,13 @@ function parseNestedStringItems(items, contentItem, options) {
263
263
  continue;
264
264
  }
265
265
  let rawMDXBlock = "";
266
+ const rawMDXBlockRendering = options.rendering === "plain" ? "plain" : "rawMDX";
266
267
  for (let rawIndex = rawMDXBlockStartIndex + 1; rawIndex < index; rawIndex += 1) {
267
268
  const rawItem = items[rawIndex];
268
269
  if (rawItem != null) rawMDXBlock += parseXMLStringItem(rawItem, contentItem, {
269
270
  languages: options.languages,
270
- rendering: "plain"
271
+ rendering: rawMDXBlockRendering,
272
+ rawMDXBlocks: options.rawMDXBlocks
271
273
  });
272
274
  }
273
275
  if (item.whitespace?.split(" ").includes("newline") === true) rawMDXBlock += "\n";
@@ -335,7 +337,7 @@ function renderRichTextItem(item, linkString, contentItem, options) {
335
337
  let result = "";
336
338
  for (const link of links) {
337
339
  const linkContent = link.identification != null ? "content" in link.identification.label ? parseXMLContent(link.identification.label, { languages }) : MultilingualString.create(contentItem.lang, parseXMLString(link.identification.label), languages) : MultilingualString.create(contentItem.lang, "", languages);
338
- const contentText = (rendering === "rich" ? linkContent.getExactRichText(contentItem.lang) : linkContent.getExactText(contentItem.lang)) ?? "";
340
+ const contentText = (rendering === "plain" ? linkContent.getExactText(contentItem.lang) : linkContent.getExactRichText(contentItem.lang)) ?? "";
339
341
  if ("type" in link && link.type != null) switch (link.type) {
340
342
  case "IIIF":
341
343
  case "image":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ochre-sdk",
3
- "version": "1.0.34",
3
+ "version": "1.0.35",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Node.js library for working with OCHRE (Online Cultural and Historical Research Environment) data",