[이윰] Prism.js 플러그인 사용 시 HTML 주석 처리가 삭제되는 문제 해결하기
페이지 정보
shadow2fox
1,111 2 2
2022.04.24 06:19:36
짧은주소
-
https://yadolee.com/tip/979 주소복사
본문
📝 Prism.js 플러그인 사용 시 HTML 주석 처리가 삭제되는 문제 해결하기
코드 구문 강조 Prism.js 사용 시 HTML 코드 중 주석 처리용 <!-- 주석 처리할 내용 및 태그 -->가 삭제되고 공란으로 나타나는 문제가 있다.
위 문제점을 수정해 보자.
그누보드5/eyoom/classes/eyoom.class.php를 열어 private function syntaxhighlighter_remove_tag($str) {를 검색하여 아래처럼 수정한다.
수정 전
private function syntaxhighlighter_remove_tag($str) {
$code = $str[0];
$code = preg_replace("/(<BR>|<BR \/>|<BR\/>|<DIV>|<\/DIV>|<P>|<\/P>)/i","",$code);
return $code;
}
수정 후
private function syntaxhighlighter_remove_tag($str) {
$code = $str[0];
$code = preg_replace("/(<BR>|<BR \/>|<BR\/>|<DIV>|<\/DIV>|<P>|<\/P>)/i","",$code);
// prism.js, <!-- --> 주석 처리 삭제 문제 해결하기
$code = preg_replace(array("/<!--/","/-->/"),array(htmlspecialchars("<!--"),htmlspecialchars("-->")),$code);
return $code;
}
추천인 2
레벨 148
경험치 3,296,614
Progress Bar 74.81%
- 가입일 : 2015-03-10 12:21:44
- 서명 : 인간에게 가장 큰 선물은
자기 자신에게 기회를 주는 것이다.
- 크리스 가드너, Chris Gardner -
- 자기소개 : There's never a shortcut to happiness.



댓글2
내사랑님의 댓글
하늘구장님의 댓글
축하합니다. 첫 댓글로 2경험치를 획득하였습니다.