Returns the user-entered highlighting options.
@param string $codeblock code block with highlighting options.
@return string the user-entered highlighting options. Null if no option is entered.
14619
protected function getHighlightTag($codeblock)
	{
		$str = trim(current(preg_split("/\r|\n/", $codeblock,2)));
		if(strlen($str) > 2 && $str[0] === '[' && $str[strlen($str)-1] === ']')
			return $str;
	}
1316909
private function getInlineRendererForClass($inlineBlockClass)
    {
        if (!isset($this->inlineRenderers[$inlineBlockClass])) {
            return null;
        }

        return $this->inlineRenderers[$inlineBlockClass];
    }
159248
public function get($block)
    {
        if ($this->enabled) {
            if (!array_key_exists($block, $this->blocks)) {
                throw new \Exception('Block '.$block.' not defined');
            }

            $this->finishBlock($block);

            return $this->blocks[$block];
        }
    }
628712
protected function getDocBlockExtraParameterRefTags($docBlock)
	{
		$results = [];
		$apiExtraParameterRefTags = $docBlock->getTagsByName('OpenApiExtraParameterRef');

		foreach ($apiExtraParameterRefTags as $apiExtraParameterRefTag) {
			$apiExtraParameterRef = trim(str_replace('@OpenApiExtraParameterRef', '', $apiExtraParameterRefTag->render()));
			$results[] = $apiExtraParameterRef;
		}

		return $results;
	}
374084
protected function extractPackageFromDocBlock($docBlock)
    {
        $packageTags = $docBlock ? $docBlock->getTagsByName('package') : [];
        if (count($packageTags) === 0) {
            return null;
        }

        /** @var DocBlock\Tags\Generic $tag */
        $tag = reset($packageTags);

        return trim((string) $tag->getDescription());
    }
367093
protected function getDocBlockOperationTags($docBlock)
	{
		$apiOperationTagTags = $docBlock->getTagsByName('OpenApiOperationTag');
		foreach ($apiOperationTagTags as $apiOperationTagTag) {
			$apiOperationTag = trim(str_replace('@OpenApiOperationTag', '',$apiOperationTagTag->render()));
			if (strstr($apiOperationTag, '[')) {
				$tags = str_replace(['[', ']'], '', $apiOperationTag);
				$tags = explode(',', $tags);
				$tags = array_map('trim', $tags);
				return $tags;
			}
			return [trim($apiOperationTag)];
		}

		return [];
	}
1271629
public static function parseBlock($block)
    {
        $data = array();
        $lines = preg_split("/(\r\n|\n|\r)/", trim($block));
        $continueKey = null;
        foreach($lines as $n => $line) {
            if ($continueKey !== null) {
                $data[$continueKey] .= "\n" . $line;
                if (!self::lineContinues($lines, $n, $continueKey)) {
                    $continueKey = null;
                }
            } elseif (preg_match('/([^:]*): ?(.*)/', $line, $match)) {
                $key = $match[1];
                $value = $match[2];
                // Convert multiple keys like 'FieldStateOption' or 'FieldValue'
                // from Choice fields to array
                if (isset($data[$key])) {
                    $data[$key]   = (array) $data[$key];
                    $data[$key][] = $value;
                } else {
                    $data[$key] = $value;
                }
                if (self::lineContinues($lines, $n, $key)) {
                    $continueKey = $key;
                }
            }
        }
        return $data;
    }
156130
@Nullable
    private ScopeBlock findScopeBlock(ScopeBlock sb, int pc) {

        if ((pc <= sb.getStart()) || (pc >= sb.getFinish())) {
            return null;
        }

        List<ScopeBlock> children = sb.getChildren();
        if (children != null) {
            for (ScopeBlock child : children) {
                ScopeBlock foundSb = findScopeBlock(child, pc);
                if (foundSb != null) {
                    return foundSb;
                }
            }
        }
        return sb;
    }
555417
function highlight() {
    $('pre code').each(function (i, block) {
      hljs.highlightBlock(block);
    });
    $('pre code[highlight-lines]').each(function (i, block) {
      if (block.innerHTML === "") return;
      var lines = block.innerHTML.split('\n');

      queryString = block.getAttribute('highlight-lines');
      if (!queryString) return;

      var ranges = queryString.split(',');
      for (var j = 0, range; range = ranges[j++];) {
        var found = range.match(/^(\d+)\-(\d+)?$/);
        if (found) {
          // consider region as `{startlinenumber}-{endlinenumber}`, in which {endlinenumber} is optional
          var start = +found[1];
          var end = +found[2];
          if (isNaN(end) || end > lines.length) {
            end = lines.length;
          }
        } else {
          // consider region as a sigine line number
          if (isNaN(range)) continue;
          var start = +range;
          var end = start;
        }
        if (start <= 0 || end <= 0 || start > end || start > lines.length) {
          // skip current region if invalid
          continue;
        }
        lines[start - 1] = '<span class="line-highlight">' + lines[start - 1];
        lines[end - 1] = lines[end - 1] + '</span>';
      }

      block.innerHTML = lines.join('\n');
    });
  }
532616
public function getHighlight(string $fieldName): ? string
    {
        return isset($this->highlights[$fieldName])
            ? ((string) $this->highlights[$fieldName])
            : null;
    }
871506
function GetFirstBlockFill()
	{
		// Returns the first blocklevel that uses a bgcolor fill
		$startfill = 0;
		for ($i = 1; $i <= $this->blklvl; $i++) {
			if ($this->blk[$i]['bgcolor'] || $this->blk[$i]['border_left']['w'] || $this->blk[$i]['border_right']['w'] || $this->blk[$i]['border_top']['w'] || $this->blk[$i]['border_bottom']['w']) {
				$startfill = $i;
				break;
			}
		}
		return $startfill;
	}
942542
public function getBlockError($blockName)
    {
        if (array_key_exists($blockName, $this->blockErrors)) {
            return $this->blockErrors[$blockName];
        }

        return null;
    }
258569
public static Function2<String, String, String> getFencedCodeBlockFormatter() {
		return (languageName, content) -> {
			/*final StringBuilder result = new StringBuilder();
			result.append("<div class=\\\"highlight"); //$NON-NLS-1$
			if (!Strings.isNullOrEmpty(languageName)) {
				result.append(" highlight-").append(languageName); //$NON-NLS-1$
			}
			result.append("\"><pre>\n").append(content).append("</pre></div>\n"); //$NON-NLS-1$ //$NON-NLS-2$
			return result.toString();*/
			return "```" + Strings.nullToEmpty(languageName).toLowerCase() + "\n" //$NON-NLS-1$ //$NON-NLS-2$
					+ content
					+ "```\n"; //$NON-NLS-1$
		};
	}
1009849
protected function block(OutputBlock $block)
    {
        if (empty($block->lines) && empty($block->children)) {
            return;
        }

        $this->currentBlock = $block;

        $pre = $this->indentStr();

        if (! empty($block->selectors)) {
            $this->blockSelectors($block);

            $this->indentLevel++;
        }

        if (! empty($block->lines)) {
            $this->blockLines($block);
        }

        if (! empty($block->children)) {
            $this->blockChildren($block);
        }

        if (! empty($block->selectors)) {
            $this->indentLevel--;

            if (empty($block->children)) {
                $this->write($this->break);
            }

            $this->write($pre . $this->close . $this->break);
        }
    }
1081032
def _selectedBlocks(self):
        
        cursor = self.textCursor()
        return self.document().findBlock(cursor.selectionStart()), \
               self.document().findBlock(cursor.selectionEnd())
746360
private function _getBlockTypeInfoForInput(ElementInterface $element = null): array
    {
        $settings = $this->getSettings();

        $blockTypes = [];

        // Set a temporary namespace for these
        $originalNamespace = Craft::$app->getView()->getNamespace();
        $namespace = Craft::$app->getView()->namespaceInputName($this->handle . '[__BLOCK_ST__][fields]', $originalNamespace);
        Craft::$app->getView()->setNamespace($namespace);

        foreach ($this->getBlockTypes() as $blockType) {
            // Create a fake SuperTableBlock so the field types have a way to get at the owner element, if there is one
            $block = new SuperTableBlockElement();
            $block->fieldId = $this->id;
            $block->typeId = $blockType->id;

            if ($element) {
                $block->setOwner($element);
                $block->siteId = $element->siteId;
            }

            $fieldLayoutFields = $blockType->getFieldLayout()->getFields();

            foreach ($fieldLayoutFields as $field) {
                $field->setIsFresh(true);
            }

            Craft::$app->getView()->startJsBuffer();

            $bodyHtml = Craft::$app->getView()->namespaceInputs(Craft::$app->getView()->renderTemplate('super-table/fields', [
                'namespace' => null,
                'fields' => $fieldLayoutFields,
                'element' => $block,
                'settings' => $settings,
                'staticField' => $this->staticField,
            ]));

            // Reset $_isFresh's
            foreach ($fieldLayoutFields as $field) {
                $field->setIsFresh(null);
            }

            $footHtml = Craft::$app->getView()->clearJsBuffer();

            $blockTypes[] = [
                'type' => $blockType->id,
                'bodyHtml' => $bodyHtml,
                'footHtml' => $footHtml,
            ];
        }

        Craft::$app->getView()->setNamespace($originalNamespace);

        return $blockTypes;
    }
1340947
public function getCkeditorOptions()
    {
        $clientOptions = [
            'height'                => $this->ckeditorHeight,
            'skin'                  => $this->ckeditorSkin,
            'codeSnippet_theme'     => $this->ckeditorCodeSnippetTheme,
        ];

        if ($this->ckeditorCodeSnippetGeshi == Cms::BOOL_Y)
        {
            $clientOptions['codeSnippetGeshi_url'] = '../lib/colorize.php';

            $preset = CKEditorPresets::getPresets($this->ckeditorPreset);
            $extraplugins = ArrayHelper::getValue($preset, 'extraPlugins', "");

            if ($extraplugins)
            {
                $extraplugins = explode(",", $extraplugins);
            }

            $extraplugins = array_merge($extraplugins, ['codesnippetgeshi']);
            $extraplugins = array_unique($extraplugins);

            $clientOptions['extraPlugins'] = implode(',', $extraplugins);
        }

        return [
            'preset' => $this->ckeditorPreset,
            'clientOptions' => $clientOptions
        ];
    }