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";
20
20
21
21
import Hooks from "../hooks" ;
22
22
import { ErrorFallback } from "./error_handler" ;
23
+ import { rtrim } from "../utils/string" ;
23
24
24
25
const REGISTERED_KEYWORDS = [
25
26
"import" ,
@@ -69,9 +70,9 @@ const CustomMDXComponents: MDXComponents = {
69
70
} ;
70
71
71
72
const lineFormatterForMDX = ( line : string ) => {
72
- const trimmedLine = line . trim ( ) ;
73
+ if ( R . isEmpty ( line . trim ( ) ) ) return "\n" ;
73
74
74
- if ( R . isEmpty ( trimmedLine ) ) return "\n" ;
75
+ const trimmedLine = rtrim ( line ) ;
75
76
76
77
// import / export / const문을 위한 꼼수 - import문 다음 줄은 반드시 빈 줄이어야 합니다.
77
78
// 그러나 \n\n으로 변환할 경우, 다음 단계에서 <br />로 변환되므로, import문 다음에 공백이 있는 줄을 넣어서 <br />로 변환되지 않도록 합니다.
Original file line number Diff line number Diff line change 1
- import * as R from "remeda" ;
2
-
3
1
import {
4
2
buildNestedSiteMap as _buildNestedSiteMap ,
5
3
findSiteMapUsingRoute as _findSiteMapUsingRoute ,
@@ -12,6 +10,7 @@ import {
12
10
filterReadOnlyPropertiesInJsonSchema as _filterReadOnlyPropertiesInJsonSchema ,
13
11
filterWritablePropertiesInJsonSchema as _filterWritablePropertiesInJsonSchema ,
14
12
} from "./json_schema" ;
13
+ import { isFilledString as _isFilledString , rtrim as _rtrim } from "./string" ;
15
14
16
15
namespace Utils {
17
16
export const buildNestedSiteMap = _buildNestedSiteMap ;
@@ -20,7 +19,8 @@ namespace Utils {
20
19
export const getCookie = _getCookie ;
21
20
export const isFormValid = _isFormValid ;
22
21
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 ;
24
24
export const filterWritablePropertiesInJsonSchema = _filterWritablePropertiesInJsonSchema ;
25
25
export const filterReadOnlyPropertiesInJsonSchema = _filterReadOnlyPropertiesInJsonSchema ;
26
26
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