I am writing a script to summarize information in DT3.
I have most of the logic working but am trying to determine the best way to programmatically create the output documents. I am using JXA but I think the question I am asking here is likely equally applicable to JXA or Applescript.
If I use createRecordWith it gives me options including rich text - but there is no option to create an HTML or Markdown document. Why is that?
Assuming I create a Rich Text document, how do I specify use of headings, bold/italics, links, and perhaps color in the code that creates the document? From the documentation it seems as if I may need to create Create text objects but I am not sure what the syntax would be there.
Let’s suppose I create to do the equivalent of this Markdown text:
This is a test
##This is a heading
This is **bold**
This is *italics*
<span style="color:blue">some *blue* text</span>
[This is a link to CNN](https://www.cnn.com)
Which should ultimately render like this in a Markdown editor:
set theNoteName to "0000-00-00 ProjectToC [" & projectName & "]"
set theSource to "<html>
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>
<meta name=\"DT:isEditableNote\" content=\"Yes\"/>
<style>
</style>
</head>
<body style=\"background-color:ivory; margin:1.5em; font-family:'Times-Roman','Times'; font-size:14px\">
<table style=\"border: 1px solid black;\">"
set theSource to theSource & "<h3>" & theHeading & "</h3>"
set theSource to theSource & "<a href=" & (item 2 of theNote) & ">" & (item 1 of theNote) & "</a><br>"
set theSource to theSource & "</tr></table></body></html>"
tell application id "DNtp"
set theFilingGroup to get record with uuid "AA28F696-D9F9-4FC3-9089-B1EDBC96011E" in database "FilingCabinet" ------ Create Note
set newRecord to create record with {name:theNoteName, type:formatted note} in theFilingGroup
set source of newRecord to theSource
set tags of newRecord to {"cType-ProjectToC", theProjectTag}
end tell