class MyNewLanguage extends PureComponent {
//
// Proptypes
static propTypes = {
regex: PropTypesthe literal text class MyNewLanguage extends PureComponent {↵↵ //↵ // Proptypes↵↵ static propTypes = {↵ regex: PropTypes (case sensitive) .any character (except for line terminators)
stringthe literal text string (case sensitive) .any character (except for line terminators)
isRequired,
flags: PropTypesthe literal text isRequired,↵ flags: PropTypes (case sensitive) .any character (except for line terminators)
stringthe literal text string (case sensitive) .any character (except for line terminators)
isRequired,
delimiter: PropTypesthe literal text isRequired,↵ delimiter: PropTypes (case sensitive) .any character (except for line terminators)
stringthe literal text string (case sensitive) .any character (except for line terminators)
isRequired,
testString: PropTypesthe literal text isRequired,↵ testString: PropTypes (case sensitive) .any character (except for line terminators)
stringthe literal text string (case sensitive) .any character (except for line terminators)
isRequired,
isSubstituting: PropTypesthe literal text isRequired,↵ isSubstituting: PropTypes (case sensitive) .any character (except for line terminators)
boolthe literal text bool (case sensitive) .any character (except for line terminators)
isRequired,
isGlobal: PropTypesthe literal text isRequired,↵ isGlobal: PropTypes (case sensitive) .any character (except for line terminators)
boolthe literal text bool (case sensitive) .any character (except for line terminators)
isRequired,
substString: PropTypesthe literal text isRequired,↵ substString: PropTypes (case sensitive) .any character (except for line terminators)
string
};
//
// Control
// If you need to manipulate any data, you should preferably do it in a function defined
// on the class body herethe literal text string↵ };↵↵ //↵ // Control↵↵ // If you need to manipulate any data, you should preferably do it in a function defined ↵ // on the class body here (case sensitive) .any character (except for line terminators)
This could for example be sanitizing data the literal text This could for example be sanitizing data (case sensitive) Group 1(escaping quotes, etc) escaping quotes, etcthe literal text escaping quotes, etc (case sensitive) .any character (except for line terminators)
//
// Render functions
renderthe literal text ↵↵ //↵ // Render functions↵↵ render (case sensitive) Group 2() — does not consume characters
{
return the literal text {↵ return (case sensitive) Group 3(
<Highlight lang="myNewLanguage">
{this._renderCode()}
</Highlight>
)
<Highlight lang="myNewLanguage">
{thisthe literal text ↵ <Highlight lang="myNewLanguage">↵ {this (case sensitive) .any character (except for line terminators)
_renderCodethe literal text _renderCode (case sensitive) Group 4() — does not consume characters
}
</Highlight>
the literal text }↵ </Highlight>↵ (case sensitive) ;
}
_renderCodethe literal text ;↵ }↵↵ _renderCode (case sensitive) Group 5() — does not consume characters
{
const { regex, flags, delimiter, testString, isSubstituting, substString, isGlobal } = thisthe literal text {↵ const { regex, flags, delimiter, testString, isSubstituting, substString, isGlobal } = this (case sensitive) .any character (except for line terminators)
props;
const codeString = new CodeStringthe literal text props;↵↵ const codeString = new CodeString (case sensitive) Group 6() — does not consume characters
;
// CodeString is a basic class that allows you to create a code snippet without having
// to worry about indentation or newlinesthe literal text ;↵ ↵ // CodeString is a basic class that allows you to create a code snippet without having↵ // to worry about indentation or newlines (case sensitive) .any character (except for line terminators)
// The only functions are `append`, `indent` and `toString`the literal text ↵↵ // The only functions are `append`, `indent` and `toString` (case sensitive) .any character (except for line terminators)
// The implementation can be found on this pagethe literal text ↵ // The implementation can be found on this page (case sensitive) .any character (except for line terminators)
// Create your code string here
codeStringthe literal text ↵↵ // Create your code string here↵ codeString (case sensitive) .any character (except for line terminators)
appendthe literal text append (case sensitive) Group 7(`Use string literals when ${regex} interpolating ${flags} data`) `Use string literals when the literal text `Use string literals when (case sensitive) $end of line
{regex} interpolating the literal text {regex} interpolating (case sensitive) $end of line
{flags} data`the literal text {flags} data` (case sensitive) ;
return codeStringthe literal text ;↵ ↵ return codeString (case sensitive) .any character (except for line terminators)
toStringthe literal text toString (case sensitive) Group 8() — does not consume characters
;
}
}
export default MyNewLangauge;the literal text ;↵ }↵↵}↵↵export default MyNewLangauge; (case sensitive) g modifier: global. Finds all matches instead of stopping after the first
m modifier: multiline. Causes ^ and $ to match the start and end of each line, not only the start and end of the string