Skip to content

Commit 01f610d

Browse files
committed
1 parent ab6a027 commit 01f610d

File tree

2 files changed

+11
-30
lines changed

2 files changed

+11
-30
lines changed
Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
.emphasis-point {
22
font-style: normal;
3-
}
4-
.dot {
5-
position: relative;
6-
display: inline-block;
7-
}
8-
.dot::after {
9-
content: ''; /* U+2027 */
10-
position: absolute;
11-
bottom: 0;
12-
left: 50%;
13-
transform: translateX(-50%);
14-
font-size: 0.5em;
15-
line-height: 1;
16-
pointer-events: none;
3+
4+
-webkit-text-emphasis: '';
5+
-moz-text-emphasis: '';
6+
text-emphasis: ''; /* U+2027 */
7+
8+
-webkit-text-emphasis-position: under;
9+
-moz-text-emphasis-position: under;
10+
text-emphasis-position: under;
1711
}

layouts/partials/utils/markdownify.html

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,9 @@
44

55
<!-- New Syntax: Emphasis Point `..中文..` -->
66
{{- if $.Site.Params.enableEmphasisPoint -}}
7-
{{- $emphasisPoints := findRE `\.\.([\p{Han}]+)\.\.` $Content -}}
8-
{{- with $emphasisPoints -}}
9-
{{- range $emphasisPoints -}}
10-
{{- $original := . -}}
11-
{{- $text := replaceRE `\.\.(.+)\.\.` `$1` $original -}}
12-
13-
{{- $chars := split $text "" -}}
14-
{{- $wrapped := "" -}}
15-
{{- range $chars -}}
16-
{{- $wrapped = printf "%s<span class=\"dot\">%s</span>" $wrapped . -}}
17-
{{- end -}}
18-
19-
{{- $replacement := printf `<em class="emphasis-point">%s</em>` $wrapped -}}
20-
{{- $Content = replace $Content $original $replacement -}}
21-
{{- end -}}
22-
{{- end -}}
7+
{{- $regexPatternEmphasisPoint := `\.\.([\p{Han}]+)\.\.` -}}
8+
{{- $regexReplacementEmphasisPoint := `<em class="emphasis-point">$1</em>` -}}
9+
{{- $Content = $Content | replaceRE $regexPatternEmphasisPoint $regexReplacementEmphasisPoint -}}
2310
{{- end -}}
2411

2512
<!-- Markdownify -->

0 commit comments

Comments
 (0)