From 53feb486b81582123806f427c88ab53776498441 Mon Sep 17 00:00:00 2001 From: Kevin Van Lierde Date: Sat, 25 Feb 2023 16:51:53 +0100 Subject: [PATCH] fix: don't log a warning for undefined key values, only when typeof is not string --- src/index.js | 3 ++- test/fixtures/default/src/index.md | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index fd0e1eb..1b1ed59 100644 --- a/src/index.js +++ b/src/index.js @@ -110,7 +110,8 @@ function markdown(options = defaultOptions) { if (typeof value === 'string') { debug.info('Rendering key "%s" of file "%s"', key.join ? key.join('.') : key, file) set(data, key, options.render(globalRefsMarkdown + value, options.engineOptions, { path: file, key })) - } else { + // log a warning if the key is defined and of an unexpected type, but not if the property simply is not defined + } else if (typeof value !== 'undefined') { debug.warn('Couldn\'t render key %s of file "%s": not a string', key.join ? key.join('.') : key, file) } }) diff --git a/test/fixtures/default/src/index.md b/test/fixtures/default/src/index.md index b245991..2594cf5 100644 --- a/test/fixtures/default/src/index.md +++ b/test/fixtures/default/src/index.md @@ -1,4 +1,6 @@ - +--- +not_a_string: false +--- # A Markdown Post With some "amazing", _riveting_, **coooonnnntent**. \ No newline at end of file