@dosgato/templating 1.1.18 → 1.2.0

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.
@@ -97,15 +97,31 @@ export interface APITemplate<DataType> {
97
97
  */
98
98
  getLinks?: LinkGatheringFn<DataType>;
99
99
  /**
100
- * Each template must provide the text from any text or rich editor data it possesses, so that
101
- * the text can be decomposed into words and indexed for fulltext searches. Any text returned
102
- * by this function will also be scanned for links.
103
- * Examples of text to include would be any text from data that's rendered as visible text content
100
+ * Each template must provide the plain text from its data so that it can be decomposed into
101
+ * words and indexed for fulltext searches. Any text returned by this function will also be
102
+ * scanned for links.
103
+ *
104
+ * Examples of text to include would be any plain text data that's rendered as visible content
104
105
  * but not things like dates and times.
106
+ *
107
+ * Rich text / HTML content should be returned via `getHtml` instead. Markup in `getFulltext`
108
+ * results will be indexed as-is, meaning tags and attributes will pollute the index.
109
+ *
105
110
  * @note You do not need to filter the text elements returned to ensure they're defined as that
106
111
  * can be done by the routine that calls `getFulltext`.
107
112
  */
108
113
  getFulltext?: FulltextGatheringFn<DataType>;
114
+ /**
115
+ * Return any HTML content from your template data so it can be parsed for indexing. The
116
+ * system will use cheerio to strip the markup and index the remaining text for fulltext
117
+ * search, and will also extract link targets (e.g. href attributes) before removing tags.
118
+ *
119
+ * This is preferable to stripping HTML yourself and returning it in getFulltext, because
120
+ * if you strip the markup yourself you'd also need to remember to extract and return links
121
+ * separately in getLinks. By returning the raw HTML here, both text and links are handled
122
+ * automatically in one place.
123
+ */
124
+ getHtml?: FulltextGatheringFn<DataType>;
109
125
  /**
110
126
  * Extra filters for this template
111
127
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dosgato/templating",
3
- "version": "1.1.18",
3
+ "version": "1.2.0",
4
4
  "description": "A library to support building templates for dosgato CMS.",
5
5
  "type": "module",
6
6
  "exports": {