File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,11 +24,13 @@ class CardComponent extends HTMLElement {
2424 this . innerHTML = `
2525 <div class="card">
2626 <a href="${ href } " class="card-link">
27- ${ imgSrc
28- ? `<div class="card-icon">
27+ ${
28+ imgSrc
29+ ? `<div class="card-icon">
2930 <img class="card-img" src="${ imgSrc } " alt="${ title } " />
3031 </div>`
31- : '' }
32+ : ''
33+ }
3234 <div class="card-content">
3335 <p class="card-description">
3436 <strong class="card-title">${ title } </strong><br />
Original file line number Diff line number Diff line change @@ -8,7 +8,8 @@ marked.setOptions({
88
99// card-component를 블록 태그 및 셀프 클로징 태그로 처리하는 커스텀 토크나이저 추가
1010// 템플릿 리터럴에서 역참조(\1) 사용 불가하므로 정규식 리터럴로 하드코딩
11- const blockTagRegex = / ^ < ( c a r d - c o m p o n e n t ) ( [ \s \S ] * ?) (?: > ( [ \s \S ] * ?) < \/ c a r d - c o m p o n e n t > | \s * \/ ) > / i;
11+ const blockTagRegex =
12+ / ^ < ( c a r d - c o m p o n e n t ) ( [ \s \S ] * ?) (?: > ( [ \s \S ] * ?) < \/ c a r d - c o m p o n e n t > | \s * \/ ) > / i;
1213
1314const customBlockTokenizer = {
1415 name : 'custom-block-tag' ,
@@ -50,11 +51,17 @@ export async function renderMarkdownWithComponents(
5051 } else if ( token . trim ( ) ) {
5152 // 나머지는 기존 방식대로 웹 컴포넌트 분리 후 마크다운 파싱
5253 const innerTokens = token
53- . split ( / ( < c a r d - c o m p o n e n t [ \s \S ] * ?< \/ c a r d - c o m p o n e n t > | < c a r d - c o m p o n e n t [ \s \S ] * ?\/ > | < b u t t o n - c o m p o n e n t [ \s \S ] * ?< \/ b u t t o n - c o m p o n e n t > | < b u t t o n - c o m p o n e n t [ \s \S ] * ?\/ > ) / gi)
54+ . split (
55+ / ( < c a r d - c o m p o n e n t [ \s \S ] * ?< \/ c a r d - c o m p o n e n t > | < c a r d - c o m p o n e n t [ \s \S ] * ?\/ > | < b u t t o n - c o m p o n e n t [ \s \S ] * ?< \/ b u t t o n - c o m p o n e n t > | < b u t t o n - c o m p o n e n t [ \s \S ] * ?\/ > ) / gi
56+ )
5457 . filter ( Boolean ) ;
5558 for ( const innerToken of innerTokens ) {
56- if ( / ^ < \/ ? ( c a r d - c o m p o n e n t | b u t t o n - c o m p o n e n t ) [ ^ > ] * ?> .* ?< \/ ( c a r d - c o m p o n e n t | b u t t o n - c o m p o n e n t ) > $ / . test ( innerToken ) ||
57- / ^ < ( c a r d - c o m p o n e n t | b u t t o n - c o m p o n e n t ) [ ^ > ] * ?\/ > $ / . test ( innerToken ) ) {
59+ if (
60+ / ^ < \/ ? ( c a r d - c o m p o n e n t | b u t t o n - c o m p o n e n t ) [ ^ > ] * ?> .* ?< \/ ( c a r d - c o m p o n e n t | b u t t o n - c o m p o n e n t ) > $ / . test (
61+ innerToken
62+ ) ||
63+ / ^ < ( c a r d - c o m p o n e n t | b u t t o n - c o m p o n e n t ) [ ^ > ] * ?\/ > $ / . test ( innerToken )
64+ ) {
5865 contentElement . innerHTML += innerToken ;
5966 } else if ( innerToken . trim ( ) ) {
6067 const html = await marked . parse ( innerToken ) ;
Original file line number Diff line number Diff line change 2121 thead {
2222 @apply bg-gray-200;
2323 }
24-
2524}
2625
2726/* 카드 컴포넌트 스타일 */
2827@layer components {
2928 .card {
30- @apply min-w-0 bg-white rounded-md border border-gray-200 px-4 py-3 mb-4 transition duration-200 hover:border-gray-300 hover:shadow h-full flex flex-col ;
29+ @apply mb-4 flex h-full min-w-0 flex-col rounded-md border border-gray-200 bg-white px-4 py-3 transition duration-200 hover:border-gray-300 hover:shadow;
3130 }
32-
31+
3332 .card-link {
3433 @apply flex items-start gap-4 no-underline;
3534 }
3635
3736 .card-icon {
38- @apply flex-shrink-0 mt-1 ;
37+ @apply mt-1 flex-shrink-0;
3938 }
4039
4140 .card-img {
42- @apply w -6 h -6;
41+ @apply h -6 w -6;
4342 }
4443
4544 .card-content {
4645 @apply flex-1;
4746 }
4847
4948 .card-description {
50- @apply text-sm text-gray-500 leading-snug ;
49+ @apply text-sm leading-snug text-gray-500;
5150 }
5251
5352 .card-title {
@@ -64,7 +63,12 @@ body {
6463 padding : 0 ;
6564}
6665
67- h1 , h2 , h3 , h4 , h5 , h6 {
66+ h1 ,
67+ h2 ,
68+ h3 ,
69+ h4 ,
70+ h5 ,
71+ h6 {
6872 font-weight : 700 ;
6973 margin-top : 1.5em ;
7074 margin-bottom : 0.5em ;
You can’t perform that action at this time.
0 commit comments