Why does DT support both formatted notes and rich text notes?

Here’s an example of a report, using tab to line up text

Well, I’d love to see the source for that HTML. Here’s what I get in DT with tabs between the columnX and valueX entries:

As is to be expected, all whitespace (including newlines!) is collapsed to just spaces.

I would think it uses the HTML character reference for Tab, 
… But no. A quick test – source shown in CotEditor to clearly show the whitespace characters:

Hmm.

(Strange detail: why the   after “`Tab`”, but not before?)

Markdown parsers usually respect HTML character references, but apparently not tab. I think that’s the first I’ve encountered that doesn’t work. For example, to write the backtick/“Grave Accent” ` above, I used: &#x60;Tab&#x60;. And to write it with code formatting here: <code>&#x60;</code>


@DTLow You could also use a markdown table for that. But of course that’s not as easy/clean as WYSIWYG tabs in a formatted note.

I would probably just use headings (h3 or h4) – I don’t see the point in formatting that in columns. But that’s personal preference.


And they’re often quite a bit smaller than web archives! Depending on the amount of images… they still take up space. Also compatible with other platforms, where web archives are only supported on macOS/iOS.

I don’t quite follow. @DTLow some about “tab key” in HTML. You must have done something else. I guess you wrote markdown and then showed the HTML preview of that. Or perhaps a formatted note? Which is of course HTML, but apparently not what one would get by simply using a tab in HTML code itself. Where does that span come from?

I stand by my statement that a tab in HTML itself is converted to a space. See, for example, here

Things may look different for HTML that’s generated from MD. Like in this case, where white-space: pre preserves the tab.

Jim, I often end up with rtf that have an assortment of fonts, font style and weights - basically, legacy stuff. Some of these rtf I care about, and want to clean up - say keep everything Frutiger 55 for regular text, 75 for emphasis. It’s too hard (for me) to think of a script to detect - in rtfs - the font, style, weight, color, and replace them.

Dunno if it makes sense… but I am investigating whether converting these rtf files to formatted gets me anywhere.

Sorry if my example wasn’t clear. You said you’d “love to see the source for that HTML”… It’s a formatted note, where I’ve used the Tab key to line up colums like I would in a plain text document. I assume this is what DTLow did. “wysiwyg editing/viewing” – input = Tab, result = Tab. You can’t do that in markdown of course, because indenting is part of the syntax.

Apparently the underlying HTML in the Formatted Note is

<span class="Apple-tab-span" style="white-space:pre">	</span>

I just edited my screenshot to make it clearer with the filename.

1 Like

@uimike looks like it could work. A simple test:

RTF (original):

Converted to Formatted Note:

HTML source shows different custom classes for the different fonts.

1 Like

Yep! exactly!

As opposed to :rofl:

{\rtf1\ansi\ansicpg1252\cocoartf2821
\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fnil\fcharset0 LucidaGrande-Bold;\f1\fnil\fcharset0 LucidaGrande;\f2\fswiss\fcharset0 Helvetica;
\f3\froman\fcharset0 Times-Roman;\f4\froman\fcharset0 Times-Italic;\f5\froman\fcharset0 Times-Bold;
\f6\fnil\fcharset0 Morandi-Regular;}
{\colortbl;\red255\green255\blue255;\red0\green0\blue233;\red24\green24\blue24;\red0\green0\blue0;
\red255\green255\blue255;\red254\green215\blue84;\red245\green241\blue239;\red12\green99\blue153;\red175\green46\blue74;
\red85\green85\blue85;\red79\green92\blue106;}
{\*\expandedcolortbl;;\cssrgb\c0\c0\c93333;\cssrgb\c12549\c12549\c12549;\cssrgb\c0\c0\c0;
\cssrgb\c100000\c100000\c100000;\cssrgb\c100000\c86667\c40000\c10196;\cssrgb\c96863\c95686\c94902;\cssrgb\c0\c46667\c66667;\cssrgb\c74902\c26275\c36078;
\cssrgb\c40784\c40784\c40784;\cssrgb\c38039\c43529\c49020;}
{\*\listtable{\list\listtemplateid1\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid1\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid1}}
{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}}
{\info
{\author Michael Cytrynowicz}}\pard\tx220\tx720\pardeftab720\li720\fi-720\sa400\partightenfactor0
\ls1\ilvl0
\f0\b\fs28 \cf2 {\listtext	\uc0\u8226 	}{\field{\*\fldinst{HYPERLINK "https://www.publicspace.net/ABetterFinderAttributes/v7/FileDatePrimer.html"}}{\fldrslt \expnd0\expndtw0\kerning0
\ul File Date Primer}}
\f1\b0 \cf3 \expnd0\expndtw0\kerning0
\
\pard\tx220\tx720\pardeftab720\li720\fi-720\partightenfactor0
\ls1\ilvl0\cf2 \kerning1\expnd0\expndtw0 {\listtext	\uc0\u8226 	}{\field{\*\fldinst{HYPERLINK "https://www.publicspace.net/ABetterFinderAttributes/v7/ContentCreationDateDestinations.html"}}{\fldrslt \expnd0\expndtw0\kerning0
\ul Setting Content Creation Dates}}\cf3 \expnd0\expndtw0\kerning0
\
\ls1\ilvl0\cf2 \kerning1\expnd0\expndtw0 {\listtext	\uc0\u8226 	}{\field{\*\fldinst{HYPERLINK "https://www.publicspace.net/ABetterFinderAttributes/v7/ContentCreationDateSources.html"}}{\fldrslt \expnd0\expndtw0\kerning0
\ul Reading Content Creation Dates}}\cf3 \expnd0\expndtw0\kerning0
\
\ls1\ilvl0\cf2 \kerning1\expnd0\expndtw0 {\listtext	\uc0\u8226 	}{\field{\*\fldinst{HYPERLINK "https://www.publicspace.net/ABetterFinderAttributes/v7/EmbeddedDateFormats.html"}}{\fldrslt \expnd0\expndtw0\kerning0
\ul Setting Dates by Using Dates Embedded in the File Names}}\cf3 \expnd0\expndtw0\kerning0
\'a0({\field{\*\fldinst{HYPERLINK "https://youtu.be/pxSRf2tG8e0"}}{\fldrslt 
\f0\b \cf2 \ul \ulc2 \'a0}}9m 49s)\
\ls1\ilvl0\cf2 \kerning1\expnd0\expndtw0 {\listtext	\uc0\u8226 	}{\field{\*\fldinst{HYPERLINK "https://www.publicspace.net/ABetterFinderAttributes/v7/LiftFileDatesFromDifferentHierarchy.html"}}{\fldrslt \expnd0\expndtw0\kerning0
\ul Taking Dates from Other Files With the Same Name in a Different Folder Hierarchy}}\cf3 \expnd0\expndtw0\kerning0
\
\ls1\ilvl0\cf2 \kerning1\expnd0\expndtw0 {\listtext	\uc0\u8226 	}{\field{\*\fldinst{HYPERLINK "https://www.publicspace.net/ABetterFinderAttributes/v7/AdvancedDateManipulation.html"}}{\fldrslt \expnd0\expndtw0\kerning0
\ul The Advanced Date Manipulation Action Action}}\expnd0\expndtw0\kerning0
\
\ls1\ilvl0\kerning1\expnd0\expndtw0 {\listtext	\uc0\u8226 	}{\field{\*\fldinst{HYPERLINK "https://www.publicspace.net/ABetterFinderAttributes/v7/IncrementingDates.html"}}{\fldrslt \expnd0\expndtw0\kerning0
\ul Incrementing Dates Using a Sort Order}}\expnd0\expndtw0\kerning0
\
\ls1\ilvl0\kerning1\expnd0\expndtw0 {\listtext	\uc0\u8226 	}{\field{\*\fldinst{HYPERLINK "https://www.publicspace.net/ABetterFinderAttributes/v7/InconsistentFileDates.html"}}{\fldrslt \expnd0\expndtw0\kerning0
\ul Inconsistent Dates}}\cf3 \expnd0\expndtw0\kerning0
\
\pard\pardeftab720\sa321\partightenfactor0

\f2\fs48 \cf0 \
\pard\pardeftab720\sa384\partightenfactor0

\f3\fs38\fsmilli19200 \AppleTypeServices\AppleTypeServicesF65539 \cf0 \cb5 DEVONthink (DT) is a document management software with a companion app for i*OS. It has a comprehensive scripting dictionary which makes it attractive and easy to automate. Most publicly 
\f4\i\fs50\fsmilli25200 \AppleTypeServices\AppleTypeServicesF65539 available examples are in AppleScript, the following scripts show how to achieve some goals with JXA.
\f3\i0\fs38\fsmilli19200 \AppleTypeServices\AppleTypeServicesF65539 \

\f5\b \AppleTypeServices\AppleTypeServicesF65539 \cb6 Note that before DT version 3.8 the examples here will not run as scripts in smart rules. From DT 3.8, you can use them as smart rule scripts by enveloping the code in
\f3\b0 \AppleTypeServices\AppleTypeServicesF65539 \cb1 \
\pard\pardeftab720\partightenfactor0

\f2\fs30\fsmilli15360 \AppleTypeServices \cf0 \cb7 \shad\shadx0\shady-20\shadr0\shado255 \shadc0   \cf8 \shad\shadx0\shady-20\shadr0\shado255 \shadc0 function\cf0 \shad\shadx0\shady-20\shadr0\shado255 \shadc0  \cf9 \shad\shadx0\shady-20\shadr0\shado255 \shadc0 performsmartrule\cf10 \shad\shadx0\shady-20\shadr0\shado255 \shadc0 (\cf0 \shad\shadx0\shady-20\shadr0\shado255 \shadc0 records\cf10 \shad\shadx0\shady-20\shadr0\shado255 \shadc0 )\{\cf0 \shad\shadx0\shady-20\shadr0\shado255 \shadc0  \
    \cf11 \shad\shadx0\shady-20\shadr0\shado255 \shadc0 //code goes here \cf0 \shad\shadx0\shady-20\shadr0\shado255 \shadc0 \
  \cf10 \shad\shadx0\shady-20\shadr0\shado255 \shadc0 \}\cf0 \cb1 \shad\shadx0\shady-20\shadr0\shado255 \shadc0 \
\
\
\
\pard\pardeftab720\partightenfactor0

\f3 \cf0 \cb6 \shad0 Copy
\fs38\fsmilli19200 \AppleTypeServices\AppleTypeServicesF65539 \cb1 \
\pard\pardeftab720\qj\partightenfactor0

\f6\fs32 \AppleTypeServices \cf0 \cb6 Here,\'a0records\'a0refers to the records selected by the smart group condition(s), so there\'92s no need to use\'a0app.selectedRecords()\'a0in a smart rule script.
\f3\fs38\fsmilli19200 \AppleTypeServices\AppleTypeServicesF65539 \cb1 \

And I suppose some regex would do the trick?

For what? Seems I didn’t quite get your end goal.

Ah, for replacing fonts in some legacy rtf, where there might be a mishmash of fonts, weights, colors… some of my MUCH older rtfs may have 3, 4 different fonts, and I wanted to do some clean up. Say, just use Frutiger 55 for regular text, Frutiger 75 for anything that is bold.

A (made-up, but realistic) example:

On Formatted Note: I am now totally convinced.

I have captured a few of the typical things I capture - e.g., some BBC article, as formatted note, and I love it.

With the added bonus that it is very easy to just delete portions that are irrelevant - say all the gunk after the end of the article, such as links to other unrelated things. Easy Peasy.

2 Likes

And the article format is very nicely preserved.

Maybe we should split the RTF stuff into another thread?

I think I see what you’re getting at, but it could still be clearer. (not sure about edge cases) You’d want to normalize everything, then do some adjustments?

For clipping, when I’m only really after the text content – like articles – I still prefer markdown, sometimes PDF. With markdown it’s easier to adjust the overall styling with CSS. But I do use Formatted Notes for clipping too.

Yep, I’ll post about rtf a bit later - thank you for the suggestion. But, yes - normalize and adjust.

For the topic at hand: I am now thinking of basically markdown for text, formatted note for when the images are essential (which is 99% my case).

Every time I find (with help from my esteemed colleagues here) more and more smart things DT does.

Images work fine in markdown too. You can always use Tools > Import Online Markdown Images. But the images are kept as separate files, referenced in the markdown document. Some people don’t like that and want documents with images to be a “self-contained” file.

4 Likes

Me, for one :slight_smile:

As I do have some tendency to move things around sometimes, I can loose files in “associated” folders

I should probably amend my take of formatted notes to „HTML on steroids“. Apparently, DT does something in the background to handle tabs (and presumably other things?). I was thinking of „pure“ HTML.
Everything’s clear now.

1 Like

Yuck. Inline styles. Nearly impossible to override with CSS. I should probably stop thinking of formatted notes as being HTML at all :disappointed_relieved:

1 Like

Well, for fairly well-structured sites, I find that some curating is easy if I convert the weblocs to formatted note, do some minor clean-up (getting rid of adds and irrelevant content) - and then I can even convert these formatted notes to pdf, generating some pretty clean pdf files.