File tree Expand file tree Collapse file tree 3 files changed +12
-5
lines changed
Expand file tree Collapse file tree 3 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import * as R from "remeda";
2020
2121import Hooks from "../hooks" ;
2222import { ErrorFallback } from "./error_handler" ;
23+ import { rtrim } from "../utils/string" ;
2324
2425const REGISTERED_KEYWORDS = [
2526 "import" ,
@@ -69,9 +70,9 @@ const CustomMDXComponents: MDXComponents = {
6970} ;
7071
7172const lineFormatterForMDX = ( line : string ) => {
72- const trimmedLine = line . trim ( ) ;
73+ if ( R . isEmpty ( line . trim ( ) ) ) return "\n" ;
7374
74- if ( R . isEmpty ( trimmedLine ) ) return "\n" ;
75+ const trimmedLine = rtrim ( line ) ;
7576
7677 // import / export / const문을 위한 꼼수 - import문 다음 줄은 반드시 빈 줄이어야 합니다.
7778 // 그러나 \n\n으로 변환할 경우, 다음 단계에서 <br />로 변환되므로, import문 다음에 공백이 있는 줄을 넣어서 <br />로 변환되지 않도록 합니다.
Original file line number Diff line number Diff line change 1- import * as R from "remeda" ;
2-
31import {
42 buildNestedSiteMap as _buildNestedSiteMap ,
53 findSiteMapUsingRoute as _findSiteMapUsingRoute ,
@@ -12,6 +10,7 @@ import {
1210 filterReadOnlyPropertiesInJsonSchema as _filterReadOnlyPropertiesInJsonSchema ,
1311 filterWritablePropertiesInJsonSchema as _filterWritablePropertiesInJsonSchema ,
1412} from "./json_schema" ;
13+ import { isFilledString as _isFilledString , rtrim as _rtrim } from "./string" ;
1514
1615namespace Utils {
1716 export const buildNestedSiteMap = _buildNestedSiteMap ;
@@ -20,7 +19,8 @@ namespace Utils {
2019 export const getCookie = _getCookie ;
2120 export const isFormValid = _isFormValid ;
2221 export const getFormValue = _getFormValue ;
23- export const isFilledString = ( obj : unknown ) : obj is string => R . isString ( obj ) && ! R . isEmpty ( obj ) ;
22+ export const isFilledString = _isFilledString ;
23+ export const rtrim = _rtrim ;
2424 export const filterWritablePropertiesInJsonSchema = _filterWritablePropertiesInJsonSchema ;
2525 export const filterReadOnlyPropertiesInJsonSchema = _filterReadOnlyPropertiesInJsonSchema ;
2626 export const filterPropertiesByLanguageInJsonSchema = _filterPropertiesByLanguageInJsonSchema ;
Original file line number Diff line number Diff line change 1+ import * as R from "remeda" ;
2+
3+ export const isFilledString = ( obj : unknown ) : obj is string => R . isString ( obj ) && ! R . isEmpty ( obj ) ;
4+
5+ // Remove whitespace from the right side of the input string.
6+ export const rtrim = ( x : string ) : string => x . replace ( / \s + $ / gm, "" ) ;
You can’t perform that action at this time.
0 commit comments