Here’s what I would suggest, with the Obsidian import as an example:
Import the various text files (as is) into a Docs DB as you suggest.
Write an automation script something like this:
const fibery = context.getService('fibery');
//get the whole schema
const schema = await fibery.getSchema();
//get the entity type
const typeName = args.currentEntities[0].type;
// filter the schema for the specific type and get the spacename and database id
const namespace = schema['typeObjects'].filter((obj) => obj.name == typeName)[0]['nameParts']['namespace'];
const databaseID = schema['typeObjects'].filter((obj) => obj.name == typeName)[0]['id']
//get all documents in the database (assumes DB is called Doc)
const allDocs = await fibery.graphql(namespace, "{ findDocs{ id, name }}");
//create a lookup table that matches entity names to 'mentions'
//the mentions are constructed from the database id and the entity id
const lookupTable = allDocs['data']['findDocs'].reduce((obj, item) => (obj[item.name] = "[[#^" + databaseID + "/" + item.id + "]]", obj), {});
//for each entity
for (const entity of args.currentEntities) {
//get the contents of the Description field (change to suit)
const textToUpdate = await fibery.getDocumentContent(entity['Description']['Secret']);
//check for not null doc
if (textToUpdate !== null) {
//look for substrings that match the Obsidian formatting (as exported from Fibery)
//Note: Fibery escapes the [ and ] characters with backspaces, so we are looking for
// \[\[Title of obsidian document\]\]
//and the regex needs to escape these characters!
const replacementText = textToUpdate.replace(/\\\[\\\[[^\\\]]+\\\]\\\]/g, (match, key) => {
//trim to get the title to be looked up (remove the \[\[ and \]\] bits )
const title = match.replace(/\\\[\\\[|\\\]\\\]/g, '');
//if a match exists in the lookupTable, then replace
return lookupTable[title] !== undefined
? lookupTable[title]
: match;
});
//write the resultant text back to the Description field
await fibery.setDocumentContent(entity['Description']['Secret'], replacementText)
}
};
I hope the comments explain what it is doing.
I suggest running the script on a couple of sample Obsidian docs to check it works, then doing all your Obsidian docs.
Then you will probably have to experiment a bit to get the right regex for Quip and Notion, but hopefully you can figure these out.
Adding some console logging will no doubt make it easier to debug ![]()
If not, come back to the community and we’ll help ![]()
You might want to read this topic to see why the lookupTable is formatted the way it is:
Entity mentions work similarly to comments, but use [[#^xxxxxx/yyyyyy]] instead.