From 12ac6ef086e7d29e8679cf43209421cf8116ee74 Mon Sep 17 00:00:00 2001 From: Philipp Burckhardt Date: Wed, 9 Sep 2026 12:26:14 +0000 Subject: [PATCH] refactor: use `format` to construct error in `_tools/remark/plugins/remark-namespace-toc` Normalize error-message construction in the TOC transformer to use `@stdlib/string/format` in place of string concatenation, matching the sibling convention in `_tools/remark/plugins`. `format` is the error-construction idiom in 11 of the 12 error-constructing packages in the namespace (~92%); `remark-namespace-toc` was the sole outlier. The rendered message text is unchanged. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01DUP1buS4hqMNkdDbim1cNn --- .../remark/plugins/remark-namespace-toc/lib/transformer.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/_tools/remark/plugins/remark-namespace-toc/lib/transformer.js b/lib/node_modules/@stdlib/_tools/remark/plugins/remark-namespace-toc/lib/transformer.js index 97be45b81c17..f262a951fde9 100644 --- a/lib/node_modules/@stdlib/_tools/remark/plugins/remark-namespace-toc/lib/transformer.js +++ b/lib/node_modules/@stdlib/_tools/remark/plugins/remark-namespace-toc/lib/transformer.js @@ -25,6 +25,7 @@ var visit = require( 'unist-util-visit' ); var createTOC = require( '@stdlib/_tools/markdown/namespace-toc' ); var startsWith = require( '@stdlib/string/starts-with' ); var endsWith = require( '@stdlib/string/ends-with' ); +var format = require( '@stdlib/string/format' ); // VARIABLES // @@ -171,7 +172,7 @@ function transformer( tree, file ) { } } if ( i === parent.children.length - 1 ) { - throw new Error( 'invalid node. Invalid table of contents (toc) comment. Ensure that the Markdown file includes both starting and ending `toc` comments. Node: `' + node.value + '`.' ); + throw new Error( format( 'invalid node. Invalid table of contents (toc) comment. Ensure that the Markdown file includes both starting and ending `toc` comments. Node: `%s`.', node.value ) ); } if ( found ) { debug( 'Append links to links section...' );