feat: enhance markdown preview for backlinks (#8956)

fix AF-1770
fix AF-1771

---

fix: doc link middlewares
feat: markdown renderer
feat: allow multiple backlink for a single doc
feat: showing correct doc ref link
feat: trim long para & ident lists
feat: list indentition fix
feat: database/latext handling
feat: other block types handling
fix: lint
This commit is contained in:
pengx17
2024-12-02 10:29:44 +00:00
parent b8467a91b8
commit 31bab2507e
19 changed files with 942 additions and 186 deletions

View File

@@ -48,11 +48,23 @@ export const InfoTable = ({
[docId, docsSearchService]
)
);
const backlinks = useLiveData(
useMemo(
() => LiveData.from(docsSearchService.watchRefsTo(docId), null),
[docId, docsSearchService]
)
useMemo(() => {
return LiveData.from(docsSearchService.watchRefsTo(docId), []).map(
links => {
const visitedDoc = new Set<string>();
// for each doc, we only show the first block
return links.filter(link => {
if (visitedDoc.has(link.docId)) {
return false;
}
visitedDoc.add(link.docId);
return true;
});
}
);
}, [docId, docsSearchService])
);
const onBacklinkPropertyChange = useCallback(