Serialization options show up clearly in most of the related documentation sections, but I think a markup glitch may have crept into the options tables for:
- outline.serialize
- outline.reloadSerialization
https://www.taskpaper.com/guide/reference/scripting/Outline.html
FWIW I think this was what I was after : -)
outline.serialize({
type: ItemSerializer.BMLType
})
Any updates on this @jessegrosjean ?
In the meanwhile, I think the set of values available for typeString in {type: typeString}
as in for example:
outline.serialize({
type: ItemSerializer.BMLType
})
may be accessible in these terms:
Expand disclosure triangle to view JS Source
(() => {
"use strict";
// ItemSerializer Type values
// ----------------------- JXA -----------------------
const main = () => {
const
taskpaper = Application("TaskPaper"),
windows = taskpaper.windows;
return 0 < windows.length ? (
windows.at(0).document.evaluate({
script: `${TaskPaperContext}`
})
) : "Nothing open in TaskPaper";
};
// ---------------- TASKPAPER CONTEXT ----------------
const TaskPaperContext = () =>
Object.getOwnPropertyNames(
ItemSerializer
)
.flatMap(
k => k.endsWith("Type") && (
/[A-Z]/u
).test(k[0]) ? (
[`ItemSerializer.${k} -> "${ItemSerializer[k]}"`]
) : []
)
.join("\n");
// JXA context main
return main();
})();
ItemSerializer.ItemReferencesType -> "application/json+item-ids"
ItemSerializer.BMLType -> "text/bml+html"
ItemSerializer.BMLMimeType -> "text/bml+html"
ItemSerializer.OPMLType -> "text/opml+xml"
ItemSerializer.OPMLMimeType -> "text/opml+xml"
ItemSerializer.TaskPaperType -> "text/taskpaper"
ItemSerializer.TaskPaperMimeType -> "text/taskpaper"
ItemSerializer.WriteRoomType -> "text/writeroom"
ItemSerializer.WriteRoomMimeType -> "text/writeroom"
ItemSerializer.TEXTType -> "text/plain"
ItemSerializer.TEXTMimeType -> "text/plain"
1 Like