From ebe0434a6eb0d43b92129cef7a59cb58a3f11cb7 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Tue, 19 Oct 2021 20:47:17 +0100 Subject: Update document transform example for monospace fonts --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 90d85a6..3e8d3a1 100644 --- a/README.md +++ b/README.md @@ -544,10 +544,12 @@ var options = { Or if you want paragraphs that have been explicitly set to use monospace fonts to represent code: ```javascript +const monospaceFonts = ["consolas", "courier"]; + function transformParagraph(paragraph) { var runs = mammoth.transforms.getDescendantsOfType(paragraph, "run"); var isMatch = runs.length > 0 && runs.every(function(run) { - return run.font && fonts.indexOf(run.font.toLowerCase()) !== -1; + return run.font && monospaceFonts.indexOf(run.font.toLowerCase()) !== -1; }); if (isMatch) { return { -- cgit v1.2.3