diff options
| author | Michael Williamson <mike@zwobble.org> | 2021-10-19 20:47:17 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2021-10-19 20:47:17 +0100 |
| commit | ebe0434a6eb0d43b92129cef7a59cb58a3f11cb7 (patch) | |
| tree | b0563c6aa0b82c2978904e207a876bc451ce9b2b | |
| parent | 4b75771fb57ef42ea424fdcfb3a65e6c480f025d (diff) | |
Update document transform example for monospace fonts
| -rw-r--r-- | README.md | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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 { |
