Remove the parsable tags when showing raw snip
This commit is contained in:
parent
669cbfdaca
commit
980ea6af94
@ -51,7 +51,7 @@ class SnipController extends AbstractController
|
|||||||
$snipService = $this->snipServiceFactory->create($snip);
|
$snipService = $this->snipServiceFactory->create($snip);
|
||||||
return $this->render('snip/single.html.twig', [
|
return $this->render('snip/single.html.twig', [
|
||||||
'snip' => $snip,
|
'snip' => $snip,
|
||||||
'content' => (new Pipeline())->parse(($snipService->get())),
|
'content' => (new Pipeline())->parse($snipService->get()),
|
||||||
'branch' => $snipService->getRepo()->getCurrentBranchName(),
|
'branch' => $snipService->getRepo()->getCurrentBranchName(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@ -62,7 +62,7 @@ class SnipController extends AbstractController
|
|||||||
$this->denyAccessUnlessGranted(SnipVoter::VIEW, $snip);
|
$this->denyAccessUnlessGranted(SnipVoter::VIEW, $snip);
|
||||||
|
|
||||||
$response = new Response(
|
$response = new Response(
|
||||||
$this->snipServiceFactory->create($snip)->get(),
|
(new Pipeline())->clean($this->snipServiceFactory->create($snip)->get()),
|
||||||
Response::HTTP_OK,
|
Response::HTTP_OK,
|
||||||
['Content-Type' => 'text/html']
|
['Content-Type' => 'text/html']
|
||||||
);
|
);
|
||||||
|
@ -19,4 +19,13 @@ class Pipeline
|
|||||||
|
|
||||||
return $pipeline->process($payload);
|
return $pipeline->process($payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function clean(string $payload): string
|
||||||
|
{
|
||||||
|
return str_replace(
|
||||||
|
['```', '``'],
|
||||||
|
'',
|
||||||
|
$payload
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user