From 0e76a8792df20866cf28a1d2c961fad29b83b88f Mon Sep 17 00:00:00 2001 From: Pierre Lairez Date: Wed, 25 Sep 2024 15:13:17 +0200 Subject: [PATCH] Add the option {generateGraph: false} The option generateGraph (default: true) generates some graph information with every bibliography item. When dealing with large bib files (1MB in my case), this causes a crash in citeproc-js, precisely here: https://github.com/Juris-M/citeproc-js/blob/57e3584632fe44db410da1771c4b6bd69fe729f9/src/build.js#L553 The function retrieveItem makes all bib items go through JSON.stringify and JSON.parse. JSON.stringify crashes on big inputs. Therefore, it is better to use {generateGraph: false}, I don't think we loose any feature as far as rehype-citation is concerned. --- src/generator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/generator.js b/src/generator.js index e9dddaa..5b0ebaf 100644 --- a/src/generator.js +++ b/src/generator.js @@ -73,7 +73,7 @@ const rehypeCitationGenerator = (Cite) => { } } } - const citations = new Cite(bibtexFile) + const citations = new Cite(bibtexFile, {generateGraph: false}); const citationIds = citations.data.map((x) => x.id) const citationPre = [] const citationDict = {}