File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed
packages/site-kit/src/lib/markdown Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -42,14 +42,24 @@ export const slugify = (str: string) => {
42
42
. replace ( / - $ / , '' ) ;
43
43
} ;
44
44
45
+ /**
46
+ * Replace dumb quotes with smart quotes. This isn't a perfect algorithm — it
47
+ * wouldn't correctly handle `That '70s show` or `My country 'tis of thee` but
48
+ * a) it's very unlikely they'll occur in our docs, and
49
+ * b) they can be dealt with manually
50
+ */
45
51
export function smart_quotes (
46
52
str : string ,
47
- { first = true , html = false } : { first ?: boolean ; html ?: boolean } = { }
53
+ {
54
+ first = true ,
55
+ html = false
56
+ } : {
57
+ /** True if the string is the entire sentence or false if it's a substring. @default true */
58
+ first ?: boolean ;
59
+ /** True if the string has HTML entities. @default false */
60
+ html ?: boolean ;
61
+ } = { }
48
62
) {
49
- // replace dumb quotes with smart quotes. This isn't a perfect algorithm — it
50
- // wouldn't correctly handle `That '70s show` or `My country 'tis of thee`
51
- // but a) it's very unlikely they'll occur in our docs, and
52
- // b) they can be dealt with manually
53
63
let open_quote = false ;
54
64
let res = '' ;
55
65
const len = str . length ;
You can’t perform that action at this time.
0 commit comments