Skip to content

Commit 045fa0d

Browse files
committed
fix fixture
1 parent e2f900f commit 045fa0d

6 files changed

Lines changed: 10 additions & 1003 deletions

File tree

packages/core/_tests/fixtures/md/transform-code.md

Lines changed: 8 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -3,164 +3,42 @@
33
This is normal text in markdown. Keep it.
44

55
<!-- docs CODE src='../local-code-file.js' syntax='js' -->
6-
```js
7-
const html = {
8-
tags: [
9-
'<!--',
10-
'-->'
11-
],
12-
pattern: [
13-
'<!-{2,}',
14-
'-{2,}>' // '-->'
15-
],
16-
}
17-
18-
module.exports.run = () => {
19-
const time = new Date()
20-
console.log(`Your cron ran ${time}`)
21-
}
22-
```
6+
237
<!-- /docs -->
248

259
<!-- docs CODE src='../local-code-file-lines.js' syntax='js' lines='4-5' -->
26-
```js
27-
const baz = 'foobar'
28-
console.log(`Hello ${baz}`)
29-
```
10+
3011
<!-- /docs -->
3112

3213
<!-- docs CODE src=https://raw.githubusercontent.com/DavidWells/awesome-stoicism/master/scripts/generate.js -->
33-
```js
34-
const fs = require('fs')
35-
const path = require('path')
36-
const markdownMagic = require('markdown-magic')
37-
38-
const MARKDOWN_PATH = path.join(__dirname, '..', 'README.md')
39-
const QUOTES_PATH = path.join(__dirname, '..', 'quotes.json')
40-
const QUOTES = JSON.parse(fs.readFileSync(QUOTES_PATH, 'utf8'))
41-
42-
const mdConfig = {
43-
transforms: {
44-
/* Usage example in markdown:
45-
<!-- AUTO-GENERATED-CONTENT:START (GENERATE_QUOTE_LIST)-->
46-
quote will be generated here
47-
<!-- AUTO-GENERATED-CONTENT:END -->
48-
*/
49-
GENERATE_QUOTE_LIST: function(content, options) {
50-
let md = ''
51-
QUOTES.sort(sortByAuthors).forEach((data) => {
52-
md += `- **${data.author}** ${data.quote}\n`
53-
})
54-
return md.replace(/^\s+|\s+$/g, '')
55-
}
56-
}
57-
}
58-
59-
/* Utils functions */
60-
function sortByAuthors(a, b) {
61-
const aName = a.author.toLowerCase()
62-
const bName = b.author.toLowerCase()
63-
return aName.localeCompare(bName)
64-
}
65-
66-
markdownMagic(MARKDOWN_PATH, mdConfig, () => {
67-
console.log('quotes', QUOTES.length)
68-
console.log('Docs updated!')
69-
})
70-
```
14+
7115
<!-- /docs -->
7216

7317
<!-- docs
7418
CODE
7519
src=https://raw.githubusercontent.com/DavidWells/awesome-stoicism/master/package.json
7620
lines=3-4
7721
-->
78-
```json
79-
"private": true,
80-
"version": "1.0.0",
81-
```
22+
8223
<!-- /docs -->
8324

8425
<!-- docs CODE src='../local-code-file-lines.js' syntax='js' lines='4-5' -->
85-
```js
86-
const baz = 'foobar'
87-
console.log(`Hello ${baz}`)
88-
```
26+
8927
<!-- /docs -->
9028

9129
<!-- docs (CODE:src=../local-code-file.js&syntax=js) -->
92-
```js
93-
const html = {
94-
tags: [
95-
'<!--',
96-
'-->'
97-
],
98-
pattern: [
99-
'<!-{2,}',
100-
'-{2,}>' // '-->'
101-
],
102-
}
103-
104-
module.exports.run = () => {
105-
const time = new Date()
106-
console.log(`Your cron ran ${time}`)
107-
}
108-
```
30+
10931
<!-- /docs -->
11032

11133
<!-- docs (CODE:src=../local-code-file-lines.js&syntax=js&lines=4-5) -->
112-
```js
113-
const baz = 'foobar'
114-
console.log(`Hello ${baz}`)
115-
```
34+
11635
<!-- /docs -->
11736

11837
<!-- docs (CODE:src=https://raw.githubusercontent.com/DavidWells/awesome-stoicism/master/scripts/generate.js) -->
119-
```js
120-
const fs = require('fs')
121-
const path = require('path')
122-
const markdownMagic = require('markdown-magic')
123-
124-
const MARKDOWN_PATH = path.join(__dirname, '..', 'README.md')
125-
const QUOTES_PATH = path.join(__dirname, '..', 'quotes.json')
126-
const QUOTES = JSON.parse(fs.readFileSync(QUOTES_PATH, 'utf8'))
127-
128-
const mdConfig = {
129-
transforms: {
130-
/* Usage example in markdown:
131-
<!-- AUTO-GENERATED-CONTENT:START (GENERATE_QUOTE_LIST)-->
132-
quote will be generated here
133-
<!-- AUTO-GENERATED-CONTENT:END -->
134-
*/
135-
GENERATE_QUOTE_LIST: function(content, options) {
136-
let md = ''
137-
QUOTES.sort(sortByAuthors).forEach((data) => {
138-
md += `- **${data.author}** ${data.quote}\n`
139-
})
140-
return md.replace(/^\s+|\s+$/g, '')
141-
}
142-
}
143-
}
144-
145-
/* Utils functions */
146-
function sortByAuthors(a, b) {
147-
const aName = a.author.toLowerCase()
148-
const bName = b.author.toLowerCase()
149-
return aName.localeCompare(bName)
150-
}
151-
152-
markdownMagic(MARKDOWN_PATH, mdConfig, () => {
153-
console.log('quotes', QUOTES.length)
154-
console.log('Docs updated!')
155-
})
156-
```
15738
<!-- /docs -->
15839

15940
<!-- docs (CODE:src=https://raw.githubusercontent.com/DavidWells/awesome-stoicism/master/package.json&lines=3-4) -->
160-
```json
161-
"private": true,
162-
"version": "1.0.0",
163-
```
41+
16442
<!-- /docs -->
16543

16644
This is normal text in markdown. Keep it.

packages/core/_tests/fixtures/md/transform-custom.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ Cool Cool Cool Cool Cool Cool Cool Cool Cool Cool Cool Cool Cool Cool Cool Cool
44
Cool Cool Cool Cool Cool Cool Cool Cool Cool Cool Cool Cool Cool Cool Cool Cool Cool Cool Cool Cool Cool
55

66
<!-- docs transformOne -->
7-
This section was generated by the cli config md.config.js file
87
<!-- /docs -->
98

109
## Testing

packages/core/_tests/fixtures/md/transform-file.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,3 @@ Old comment syntax
2121
<!-- AUTO-GENERATED-CONTENT:START (FILE:src=../local-code-file-lines.js) -->
2222
Old comment syntax
2323
<!-- AUTO-GENERATED-CONTENT:END -->
24-

packages/core/_tests/fixtures/md/transform-fileTree.md

Lines changed: 2 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -3,112 +3,16 @@
33
## Basic file tree
44

55
<!-- docs fileTree src="../../fixtures" maxDepth=2 -->
6-
```
7-
└── fixtures/
8-
├── js/
9-
│ └── simple.js
10-
├── md/
11-
│ ├── nested/
12-
│ │ ...
13-
│ ├── transform-file/
14-
│ │ ...
15-
│ ├── transform-toc/
16-
│ │ ...
17-
│ ├── basic.md
18-
│ ├── broken-inline.md
19-
│ ├── broken-whitespace-file.md
20-
│ ├── error-missing-transforms-two.md
21-
│ ├── error-missing-transforms.md
22-
│ ├── error-no-block-transform-defined.md
23-
│ ├── error-unbalanced.md
24-
│ ├── format-inline.md
25-
│ ├── format-with-wacky-indentation.md
26-
│ ├── inline-two.md
27-
│ ├── inline.md
28-
│ ├── mdx-file.mdx
29-
│ ├── missing-transform.md
30-
│ ├── mixed.md
31-
│ ├── no-transforms.md
32-
│ ├── string.md
33-
│ ├── syntax-legacy-colon.md
34-
│ ├── syntax-legacy-query.md
35-
│ ├── syntax-mixed.md
36-
│ ├── transform-code.md
37-
│ ├── transform-custom.md
38-
│ ├── transform-file.md
39-
│ ├── transform-fileTree.md
40-
│ ├── transform-remote.md
41-
│ ├── transform-toc.md
42-
│ └── transform-wordCount.md
43-
├── output/
44-
│ ├── _tests/
45-
│ │ ...
46-
│ ├── md/
47-
│ │ ...
48-
│ └── test/
49-
│ ...
50-
├── local-code-file-lines.js
51-
├── local-code-file.js
52-
└── local-code-id.js
53-
```
546
<!-- /docs -->
557

568
## File tree with list format
579

5810
<!-- docs fileTree src="../../fixtures" maxDepth=2 format="list" -->
59-
- **fixtures/**
60-
- **js/**
61-
- simple.js
62-
- **md/**
63-
- **nested/**
64-
- ...
65-
- **transform-file/**
66-
- ...
67-
- **transform-toc/**
68-
- ...
69-
- basic.md
70-
- broken-inline.md
71-
- broken-whitespace-file.md
72-
- error-missing-transforms-two.md
73-
- error-missing-transforms.md
74-
- error-no-block-transform-defined.md
75-
- error-unbalanced.md
76-
- format-inline.md
77-
- format-with-wacky-indentation.md
78-
- inline-two.md
79-
- inline.md
80-
- mdx-file.mdx
81-
- missing-transform.md
82-
- mixed.md
83-
- no-transforms.md
84-
- string.md
85-
- syntax-legacy-colon.md
86-
- syntax-legacy-query.md
87-
- syntax-mixed.md
88-
- transform-code.md
89-
- transform-custom.md
90-
- transform-file.md
91-
- transform-fileTree.md
92-
- transform-remote.md
93-
- transform-toc.md
94-
- transform-wordCount.md
95-
- **output/**
96-
- **_tests/**
97-
- ...
98-
- **md/**
99-
- ...
100-
- **test/**
101-
- ...
102-
- local-code-file-lines.js
103-
- local-code-file.js
104-
- local-code-id.js
11+
10512
<!-- /docs -->
10613

10714
## File tree with size
10815

10916
<!-- docs fileTree src="../../fixtures/js" showSize=true -->
110-
```
111-
└── js/
112-
└── simple.js (552 B)
113-
```
17+
11418
<!-- /docs -->

0 commit comments

Comments
 (0)