{"record":{"id":"ace6c5a78a378830","repo":"HandyOrg/HandyControl","slug":"label-text-must-be-defined","errorCode":null,"errorMessage":"Label text must be defined!","messagePattern":"Label text must be defined!","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"doc/themes/next/scripts/tags/label.js","lineNumber":14,"sourceCode":"/**\n * label.js | https://theme-next.org/docs/tag-plugins/label\n */\n\n/* global hexo */\n\n'use strict';\n\nfunction postLabel(args) {\n  args = args.join(' ').split('@');\n  var classes = args[0] || 'default';\n  var text    = args[1] || '';\n\n  !text && hexo.log.warn('Label text must be defined!');\n\n  return `<span class=\"label ${classes.trim()}\">${text}</span>`;\n}\n\nhexo.extend.tag.register('label', postLabel, {ends: false});\n","sourceCodeStart":1,"sourceCodeEnd":20,"githubUrl":"https://github.com/HandyOrg/HandyControl/blob/2c0875ebd67326e0c67282967e3e809c69282fee/doc/themes/next/scripts/tags/label.js#L1-L20","documentation":"The NexT theme's label Hexo tag splits its arguments on '@' into a class and a text part, and warns when the text (the part after '@') is empty. The tag still renders an empty <span class=\"label ...\"></span>. It signals a malformed tag call, not a hard failure.","triggerScenarios":"{% label @some text %} (no class given, and text contains no further '@') is fine, but writing {% label primary %} — where '@' is missing so args[1] is undefined — or {% label primary @ %} with nothing after '@' triggers the warning.","commonSituations":"Authors forgetting the '@' separator between label color class and text, or copying an example where the class was omitted leaving only one argument.","solutions":["Write the label as {% label class @ text %}, e.g. {% label primary @ Important %}.","Ensure the '@' separator is present and followed by the label text.","If you want the default class, start the argument with '@': {% label @ My text %}."],"exampleFix":"// before\n{% label primary %}\n// after\n{% label primary @ Important note %}","handlingStrategy":"validation","validationCode":"function checkLabelArgs(rawArgs) {\n  const parts = rawArgs.join(' ').split('@');\n  const text = parts[1];\n  if (!text || !text.trim()) {\n    console.warn('{% label %} requires text after \"@\", e.g. {% label primary @ text %}');\n    return false;\n  }\n  return true;\n}","typeGuard":"function hasLabelText(args) {\n  const parts = args.join(' ').split('@');\n  return typeof parts[1] === 'string' && parts[1].trim().length > 0;\n}","tryCatchPattern":null,"preventionTips":["Always use the {% label class @ text %} form with the '@' separator.","Never leave the text after '@' empty.","Grep post sources for `label %}` calls lacking '@' in a pre-build check."],"tags":["hexo","theme","missing-argument","markdown"],"backgroundTag":"missing-required-argument","analyzedSha":"2c0875ebd67326e0c67282967e3e809c69282fee","analyzedAt":"2026-09-14T14:45:29.754Z","contentChangedAt":"2026-09-14T14:45:29.754Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}