File tree Expand file tree Collapse file tree 3 files changed +469
-5
lines changed Expand file tree Collapse file tree 3 files changed +469
-5
lines changed Original file line number Diff line number Diff line change @@ -307,7 +307,13 @@ export const convertRawTypstAstObjectToTextlintAstObject = (
307
307
if ( node . loc . start . line === node . loc . end . line ) {
308
308
// If Code
309
309
node . type = ASTNodeTypes . Code ;
310
- node . value = node . raw . replace ( / ` ( [ \s \S ] * ?) ` / , "$1" ) ;
310
+ if ( / ^ ` ` ` ( [ \s \S ] * ?) ` ` ` $ / . test ( node . raw ) ) {
311
+ const codeBlockPattern = / ^ ` ` ` ( \w + ) ? \s ( [ \s \S ] * ?) \s * ` ` ` $ / ;
312
+ const match = node . raw . match ( codeBlockPattern ) ;
313
+ node . value = match ? match [ 2 ] . trim ( ) : "" ;
314
+ } else {
315
+ node . value = node . raw . replace ( / ` ( [ \s \S ] * ?) ` / , "$1" ) ;
316
+ }
311
317
} else {
312
318
// If CodeBlock
313
319
node . type = ASTNodeTypes . CodeBlock ;
Original file line number Diff line number Diff line change 1
1
`inline code`
2
2
3
3
aaa `inline code` bbb
4
+
5
+ What is ```rust fn main()``` in Rust
6
+ would be ```c int main()``` in C.
7
+
8
+ This has ``` `backticks` ``` in it
9
+ (but the spaces are trimmed). And
10
+ ``` here``` the leading space is
11
+ also trimmed.
You can’t perform that action at this time.
0 commit comments