@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final class PhutilRemarkupUnderlineRule extends PhutilRemarkupRule {
4
5 public function getPriority() {
6 return 1000.0;
7 }
8
9 public function apply($text) {
10 if ($this->getEngine()->isTextMode()) {
11 return $text;
12 }
13
14 return $this->replaceHTML(
15 '@(?<!_|/)__([^\s_/].*?_*)__(?!/|\.\S)@s',
16 array($this, 'applyCallback'),
17 $text);
18 }
19
20 protected function applyCallback(array $matches) {
21 return hsprintf('<u>%s</u>', $matches[1]);
22 }
23
24}