We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 432e9d5 + 553a326 commit 56f23abCopy full SHA for 56f23ab
1 file changed
app/CodeFormatterApp.php
@@ -16,7 +16,7 @@ class CodeFormatterApp
16
/**
17
* @var string
18
*/
19
- protected const CODE_BLOCK_REGEX = '/(\[CODE(?:=([a-z]+)?)?\])((?:.*\n?)*)/';
+ protected const CODE_BLOCK_REGEX = '/(\[CODE(?:(?:=([a-z]+)?)|(?:\slang=\"?([a-z]+)\"?).*)?\])((?:.*\n?)*)/';
20
21
22
* @var string|array
@@ -116,8 +116,10 @@ protected function captureCodeBlockComponents(array $match)
116
{
117
// capture code block components (code tag, code language, actual code content)
118
$this->code_tag = $match[1];
119
- $this->code_language = $match[2] ?: 'txt';
120
- $this->code_content = $match[3];
+ $this->code_content = $match[4];
+
121
+ $specified_code_lang = $match[2] ?: $match[3];
122
+ $this->code_language = $specified_code_lang ?: 'txt';
123
}
124
125
0 commit comments