I want to color my comment that come between the /* */ in specific color in codemirror … I search and found sample to color the string between the " " and it work fine .
when I replace the " " by /* */ in the code then the code not color my comment .
the work code is :
CodeMirror.defineMode("strings", function() {
return {
startState: function() {return {inString: false};},
token: function(stream, state) {
// If a string starts here
if (!state.inString && stream.peek() == '"') {
stream.next(); // Skip quote
state.inString = true; // Update state
}
if (state.inString) {
if (stream.skipTo('"')) { // Quote found on this line
stream.next(); // Skip quote
state.inString = false; // Clear flag
} else {
stream.skipToEnd(); // Rest of line is string
}
return "string"; // Token style
} else {
stream.skipTo('"') || stream.skipToEnd();
return null; // Unstyled token
}
}
};
});
my try : Note I only replace the " by / and " by / but the code not work this is my try online my try
so what my wrong ?