File tree 4 files changed +10
-14
lines changed
4 files changed +10
-14
lines changed Original file line number Diff line number Diff line change 9
9
* @returns {Style|null }
10
10
*/
11
11
export function headingStyle ( node , relative ) {
12
- var last = node . children [ node . children . length - 1 ]
13
- var depth = node . depth
14
- var pos = node && node . position && node . position . end
15
- var final = last && last . position && last . position . end
12
+ const last = node . children [ node . children . length - 1 ]
13
+ const depth = node . depth
14
+ const pos = node && node . position && node . position . end
15
+ const final = last && last . position && last . position . end
16
16
17
17
if ( ! pos ) {
18
18
return null
Original file line number Diff line number Diff line change 65
65
"trailingComma" : " none"
66
66
},
67
67
"xo" : {
68
- "prettier" : true ,
69
- "rules" : {
70
- "no-var" : " off" ,
71
- "prefer-arrow-callback" : " off"
72
- }
68
+ "prettier" : true
73
69
},
74
70
"remarkConfig" : {
75
71
"plugins" : [
Original file line number Diff line number Diff line change @@ -24,11 +24,11 @@ npm install mdast-util-heading-style
24
24
## Use
25
25
26
26
``` js
27
- import unified from ' unified'
28
- import remarkParse from ' remark-parse'
27
+ import {unified } from ' unified'
29
28
import {headingStyle } from ' mdast-util-heading-style'
29
+ import remarkParse from ' remark-parse'
30
30
31
- var processor = unified ().use (remarkParse)
31
+ const processor = unified ().use (remarkParse)
32
32
33
33
headingStyle (processor .parse (' # ATX' ).children [0 ]) // => 'atx'
34
34
headingStyle (processor .parse (' # ATX #\n ' ).children [0 ]) // => 'atx-closed'
Original file line number Diff line number Diff line change @@ -7,8 +7,8 @@ import test from 'tape'
7
7
import remark from 'remark'
8
8
import { headingStyle } from './index.js'
9
9
10
- test ( 'headingStyle' , function ( t ) {
11
- t . throws ( function ( ) {
10
+ test ( 'headingStyle' , ( t ) => {
11
+ t . throws ( ( ) => {
12
12
// @ts -ignore runtime.
13
13
headingStyle ( )
14
14
} , 'should fail without node' )
You can’t perform that action at this time.
0 commit comments