From 77368330a55bfa267bf8bfaf1e9ddce169f20212 Mon Sep 17 00:00:00 2001 From: Chase McCoy Date: Sun, 25 May 2025 14:12:28 -0500 Subject: [PATCH 1/3] Update content-extractor.ts --- src/utils/content-extractor.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/utils/content-extractor.ts b/src/utils/content-extractor.ts index 9cd81939..c6e39220 100644 --- a/src/utils/content-extractor.ts +++ b/src/utils/content-extractor.ts @@ -125,6 +125,7 @@ export async function initializePageContent( } const markdownBody = createMarkdownContent(content, currentUrl); + const selectedMarkdown = selectedHtml ? markdownBody : createMarkdownContent(selectedHtml, currentUrl) // Convert each highlight to markdown individually and create an object with text, timestamp, and notes (if not empty) const highlightsData = highlights.map(highlight => { @@ -148,6 +149,8 @@ export async function initializePageContent( '{{author}}': author.trim(), '{{content}}': markdownBody.trim(), '{{contentHtml}}': content.trim(), + '{{selection}}': selectedMarkdown.trim(), + '{{selectionHtml}}': selectionHtml.trim(), '{{date}}': dayjs().format('YYYY-MM-DDTHH:mm:ssZ').trim(), '{{time}}': dayjs().format('YYYY-MM-DDTHH:mm:ssZ').trim(), '{{description}}': description.trim(), From ae4886d4cb05cfedf60ac971c010edcb1b7b38c1 Mon Sep 17 00:00:00 2001 From: Chase McCoy Date: Sun, 25 May 2025 14:14:21 -0500 Subject: [PATCH 2/3] Update Variables.md --- docs/Variables.md | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/docs/Variables.md b/docs/Variables.md index c089d1cd..933c6a4c 100644 --- a/docs/Variables.md +++ b/docs/Variables.md @@ -17,24 +17,26 @@ Preset variables are automatically generated based on the page content. These ty The main content variable is `{{content}}`, which contains the article content, or the [[Highlight web pages|highlights]], or the selection if there is any selected text on the page. Note that `{{content}}` attempts to extract the main content of the page, which may not always be what you want. In that case, you can use other preset variables or selector variables to extract the content you need. -| Variable | Description | -| ----------------- | -------------------------------------------------------------------------------------- | -| `{{author}}` | Author of the page | -| `{{content}}` | Article content, [[Highlight web pages\|highlights]], or selection, in Markdown format | -| `{{contentHtml}}` | Article content, [[Highlight web pages\|highlights]], or selection, in HTML format | -| `{{date}}` | Current date, can be formatted using the `date` filter | -| `{{description}}` | Description or excerpt | -| `{{domain}}` | Domain | -| `{{favicon}}` | Favicon URL | -| `{{fullHtml}}` | Unprocessed HTML for the full page content | -| `{{highlights}}` | [[Highlight web pages\|Highlights]] with text and timestamps | -| `{{image}}` | Social share image URL | -| `{{published}}` | Published date, can be formatted using the `date` filter | -| `{{site}}` | Site name or publisher | -| `{{title}}` | Title of the page | -| `{{time}}` | Current date and time | -| `{{url}}` | Current URL | -| `{{words}}` | Word count | +| Variable | Description | +| ------------------- | -------------------------------------------------------------------------------------- | +| `{{author}}` | Author of the page | +| `{{content}}` | Article content, [[Highlight web pages\|highlights]], or selection, in Markdown format | +| `{{contentHtml}}` | Article content, [[Highlight web pages\|highlights]], or selection, in HTML format | +| `{{selection}}` | Selection in Markdown format | +| `{{selectionHtml}}` | Selection in HTML format | +| `{{date}}` | Current date, can be formatted using the `date` filter | +| `{{description}}` | Description or excerpt | +| `{{domain}}` | Domain | +| `{{favicon}}` | Favicon URL | +| `{{fullHtml}}` | Unprocessed HTML for the full page content | +| `{{highlights}}` | [[Highlight web pages\|Highlights]] with text and timestamps | +| `{{image}}` | Social share image URL | +| `{{published}}` | Published date, can be formatted using the `date` filter | +| `{{site}}` | Site name or publisher | +| `{{title}}` | Title of the page | +| `{{time}}` | Current date and time | +| `{{url}}` | Current URL | +| `{{words}}` | Word count | ## Prompt variables From 3ff79e484cf1f2dc8339efcb902565bce26f739d Mon Sep 17 00:00:00 2001 From: Chase McCoy Date: Sun, 25 May 2025 14:21:57 -0500 Subject: [PATCH 3/3] Update content-extractor.ts --- src/utils/content-extractor.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/content-extractor.ts b/src/utils/content-extractor.ts index c6e39220..6e17a1f3 100644 --- a/src/utils/content-extractor.ts +++ b/src/utils/content-extractor.ts @@ -125,7 +125,7 @@ export async function initializePageContent( } const markdownBody = createMarkdownContent(content, currentUrl); - const selectedMarkdown = selectedHtml ? markdownBody : createMarkdownContent(selectedHtml, currentUrl) + const selectedMarkdown = createMarkdownContent(selectedHtml, currentUrl) // Convert each highlight to markdown individually and create an object with text, timestamp, and notes (if not empty) const highlightsData = highlights.map(highlight => {