applesauce-content 0.0.0-next-20241108100553 → 0.0.0-next-20241111095753

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.
@@ -1,11 +1,11 @@
1
1
  export function eolMetadata() {
2
2
  return (tree) => {
3
3
  for (let i = 0; i < tree.children.length; i++) {
4
- // const node = tree.children[i];
4
+ const node = tree.children[i];
5
5
  const next = tree.children[i + 1];
6
- if (next && next.type === "text" && next.value.startsWith("\n")) {
7
- next.data = next.data || {};
8
- next.data.eol = true;
6
+ if (!next || (next.type === "text" && next.value.startsWith("\n"))) {
7
+ node.data = node.data || {};
8
+ node.data.eol = true;
9
9
  }
10
10
  }
11
11
  };
@@ -7,9 +7,18 @@ import { createTextNoteATS } from "./parser.js";
7
7
  import { hashtags } from "./hashtag.js";
8
8
  import { galleries } from "./gallery.js";
9
9
  import { lightningInvoices } from "./lightning.js";
10
+ import { eolMetadata } from "../nast/eol-metadata.js";
10
11
  export const ParsedTextContentSymbol = Symbol.for("parsed-text-content");
11
12
  // default kind 1 transformers
12
- export const defaultTransformers = [nostrMentions, galleries, emojis, hashtags, lightningInvoices, cashuTokens];
13
+ export const defaultTransformers = [
14
+ nostrMentions,
15
+ galleries,
16
+ emojis,
17
+ hashtags,
18
+ lightningInvoices,
19
+ cashuTokens,
20
+ eolMetadata,
21
+ ];
13
22
  /** Parsed and process a note with custom transformers */
14
23
  export function getParsedTextContent(event, content, transformers = defaultTransformers) {
15
24
  // process strings
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "applesauce-content",
3
- "version": "0.0.0-next-20241108100553",
3
+ "version": "0.0.0-next-20241111095753",
4
4
  "description": "Unified plugins for processing event content",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -40,7 +40,7 @@
40
40
  "@types/hast": "^3.0.4",
41
41
  "@types/mdast": "^4.0.4",
42
42
  "@types/unist": "^3.0.3",
43
- "applesauce-core": "0.0.0-next-20241108100553",
43
+ "applesauce-core": "0.0.0-next-20241111095753",
44
44
  "linkifyjs": "^4.1.3",
45
45
  "mdast-util-find-and-replace": "^3.0.1",
46
46
  "nostr-tools": "^2.10.1",