Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93312541
PhabricatorRemarkupKaTeXBlockInterpreter.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Nov 27, 20:06
Size
838 B
Mime Type
text/x-php
Expires
Fri, Nov 29, 20:06 (2 d)
Engine
blob
Format
Raw Data
Handle
22615198
Attached To
rPH Phabricator
PhabricatorRemarkupKaTeXBlockInterpreter.php
View Options
<?php
final
class
PhabricatorRemarkupKaTeXBlockInterpreter
extends
PhutilRemarkupBlockInterpreter
{
public
function
getInterpreterName
()
{
return
'katex'
;
}
public
function
markupContent
(
$content
,
array
$argv
)
{
$future
=
id
(
new
ExecFuture
(
'node /opt/render2katex/index.js d'
))
->
setTimeout
(
15
)
->
write
(
trim
(
$content
));
list
(
$err
,
$stdout
,
$stderr
)
=
$future
->
resolve
();
if
(
$err
)
{
return
$this
->
markupError
(
pht
(
'Execution of `%s` failed (#%d), check your syntax: %s'
,
'render2katex'
,
$err
,
$stderr
));
}
$result
=
$stdout
;
$engine
=
$this
->
getEngine
();
if
(
$engine
->
isTextMode
())
{
return
$result
;
}
if
(
$engine
->
isHTMLMailMode
())
{
return
$result
;
}
return
phutil_safe_html
(
$result
);
}
}
Event Timeline
Log In to Comment