@@ -1355,6 +1355,80 @@ describe('correctTranslatedContentStrings', () => {
13551355 expect ( fix ( '{{%raw %}' , 'es' ) ) . toBe ( '{% raw %}' )
13561356 expect ( fix ( '{{% raw %}' , 'es' ) ) . toBe ( '{% raw %}' )
13571357 } )
1358+
1359+ test ( 'unescapes entity-encoded HTML tags when English source has matching raw HTML' , ( ) => {
1360+ const english =
1361+ '<td><code><a href="https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md">ubuntu-latest</a></code></td>'
1362+
1363+ expect ( fix ( '<code>ubuntu-latest</code>' , 'ko' , english ) ) . toBe (
1364+ '<code>ubuntu-latest</code>' ,
1365+ )
1366+ expect (
1367+ fix ( '<a href="https://example.com">ubuntu-latest</a>' , 'ko' , english ) ,
1368+ ) . toBe ( '<a href="https://example.com">ubuntu-latest</a>' )
1369+ expect (
1370+ fix (
1371+ '<code><a href="https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md">ubuntu-latest</a></code>' ,
1372+ 'ko' ,
1373+ english ,
1374+ ) ,
1375+ ) . toBe (
1376+ '<code><a href="https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md">ubuntu-latest</a></code>' ,
1377+ )
1378+ } )
1379+
1380+ test ( 'does not unescape entity-encoded tags absent from English source' , ( ) => {
1381+ const english = '<p>Simple paragraph without code elements</p>'
1382+ const input = '<code>text</code>'
1383+ expect ( fix ( input , 'ko' , english ) ) . toBe ( input )
1384+ } )
1385+
1386+ test ( 'does not unescape entity-encoded tags when no English content provided' , ( ) => {
1387+ const input = '<code>ubuntu-latest</code>'
1388+ expect ( fix ( input , 'ko' ) ) . toBe ( input )
1389+ } )
1390+
1391+ test ( 'removes bare code-fence wrapping from bold heading lines' , ( ) => {
1392+ const input = '```\n**다음은 작업을 다운로드하는 데 필요합니다.**\n```'
1393+ expect ( fix ( input , 'ko' ) ) . toBe ( '**다음은 작업을 다운로드하는 데 필요합니다.**' )
1394+ } )
1395+
1396+ test ( 'removes bare code-fence wrapping from bold headings between real code blocks' , ( ) => {
1397+ const input = [
1398+ '```shell copy' ,
1399+ 'github.com' ,
1400+ 'api.github.com' ,
1401+ '```' ,
1402+ '' ,
1403+ '```' ,
1404+ '**다음은 작업을 다운로드하는 데 필요합니다.**' ,
1405+ '```' ,
1406+ '' ,
1407+ '```shell copy' ,
1408+ 'codeload.github.com' ,
1409+ '```' ,
1410+ ] . join ( '\n' )
1411+
1412+ const expected = [
1413+ '```shell copy' ,
1414+ 'github.com' ,
1415+ 'api.github.com' ,
1416+ '```' ,
1417+ '' ,
1418+ '**다음은 작업을 다운로드하는 데 필요합니다.**' ,
1419+ '' ,
1420+ '```shell copy' ,
1421+ 'codeload.github.com' ,
1422+ '```' ,
1423+ ] . join ( '\n' )
1424+
1425+ expect ( fix ( input , 'ko' ) ) . toBe ( expected )
1426+ } )
1427+
1428+ test ( 'does not strip language-specified code fences with bold content' , ( ) => {
1429+ const input = '```shell\n**not a heading**\n```'
1430+ expect ( fix ( input , 'ko' ) ) . toBe ( input )
1431+ } )
13581432 } )
13591433
13601434 // ─── EDGE CASES ────────────────────────────────────────────────────
0 commit comments