Skip to content

Commit

Permalink
fix: don't log a warning for undefined key values, only when typeof i…
Browse files Browse the repository at this point in the history
…s not string
  • Loading branch information
webketje committed Feb 25, 2023
1 parent c9881d1 commit 53feb48
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
})
Expand Down
4 changes: 3 additions & 1 deletion test/fixtures/default/src/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

---
not_a_string: false
---
# A Markdown Post

With some "amazing", _riveting_, **coooonnnntent**.

0 comments on commit 53feb48

Please sign in to comment.