diff --git a/src/markup/engine/remarkup/blockrule/PhutilRemarkupCodeBlockRule.php b/src/markup/engine/remarkup/blockrule/PhutilRemarkupCodeBlockRule.php --- a/src/markup/engine/remarkup/blockrule/PhutilRemarkupCodeBlockRule.php +++ b/src/markup/engine/remarkup/blockrule/PhutilRemarkupCodeBlockRule.php @@ -132,22 +132,33 @@ $name_header = null; if ($this->getEngine()->isHTMLMailMode()) { + $map = $this->getEngine()->getConfig('phutil.codeblock.style-map'); + + if ($map) { + $raw_body = id(new PhutilPygmentizeParser()) + ->setMap($map) + ->parse((string)$code_body); + $code_body = phutil_safe_html($raw_body); + } + + $style_rules = array( + 'padding: 12px;', + 'background: rgba(71, 87, 120, 0.08);', + 'color: #000000;', + 'overflow: auto;', + 'border-radius: 3px;', + 'display: inline-block;', + ); + $header_attributes = array( - 'style' => 'padding: 6px 8px; - background: #fdf5d4; - color: rgba(0,0,0,.75); - font-weight: bold; - display: inline-block; - border-top: 1px solid #f1c40f; - border-left: 1px solid #f1c40f; - border-right: 1px solid #f1c40f; - margin-bottom: -1px;', + 'style' => implode(' ', $style_rules), ); } else { $header_attributes = array( 'class' => 'remarkup-code-header', ); } + if ($options['name']) { $name_header = phutil_tag( 'div', @@ -161,9 +172,9 @@ } $attributes = array( - 'class' => $class, - 'data-code-lang' => $options['lang'], - 'data-sigil' => 'remarkup-code-block', + 'class' => $class, + 'data-code-lang' => $options['lang'], + 'data-sigil' => 'remarkup-code-block', ); return phutil_tag(