-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from Roaders/codeExamples
Add support for insertCode
- Loading branch information
Showing
27 changed files
with
10,337 additions
and
555 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { parse } from '../parse'; | ||
import { parse } from '../'; | ||
import { argumentConfig } from './configs'; | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Code inserted from file: | ||
|
||
[//]: # (ts-command-line-args_write-markdown_insertCodeBelow file="./insert-code.example.ts" codeComment="ts") | ||
```ts | ||
async function insertSampleCode() { | ||
const fileContent = readFileSync('src/example/insert-code-sample.md').toString(); | ||
|
||
const newContent = await insertCode(fileContent, { | ||
insertCodeBelow: insertCodeBelowDefault, | ||
insertCodeAbove: insertCodeAboveDefault, | ||
copyCodeBelow: copyCodeBelowDefault, | ||
copyCodeAbove: copyCodeAboveDefault, | ||
dirname: dirname(`src/example/insert-code-sample.md`), | ||
}); | ||
|
||
writeFileSync('src/example/insert-code-sample.md', newContent); | ||
} | ||
``` | ||
[//]: # (ts-command-line-args_write-markdown_insertCodeAbove) | ||
|
||
The above code was inserted using `ts-command-line-args` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { insertCode } from '../'; | ||
import { readFileSync, writeFileSync } from 'fs'; | ||
import { dirname } from 'path'; | ||
import { | ||
copyCodeAboveDefault, | ||
copyCodeBelowDefault, | ||
insertCodeAboveDefault, | ||
insertCodeBelowDefault, | ||
} from '../write-markdown.constants'; | ||
|
||
// ts-command-line-args_write-markdown_copyCodeBelow | ||
async function insertSampleCode() { | ||
const fileContent = readFileSync('src/example/insert-code-sample.md').toString(); | ||
|
||
const newContent = await insertCode(fileContent, { | ||
insertCodeBelow: insertCodeBelowDefault, | ||
insertCodeAbove: insertCodeAboveDefault, | ||
copyCodeBelow: copyCodeBelowDefault, | ||
copyCodeAbove: copyCodeAboveDefault, | ||
dirname: dirname(`src/example/insert-code-sample.md`), | ||
}); | ||
|
||
writeFileSync('src/example/insert-code-sample.md', newContent); | ||
} | ||
// ts-command-line-args_write-markdown_copyCodeAbove | ||
|
||
insertSampleCode(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"declaration": false, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { parse } from '../parse'; | ||
import { parse } from '../'; | ||
import { argumentConfig } from './configs'; | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
src/helpers/content.helper.spec.ts → src/helpers/add-content.helper.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
export * from './command-line.helper'; | ||
export * from './content.helper'; | ||
export * from './add-content.helper'; | ||
export * from './markdown.helper'; | ||
export * from './visitor'; | ||
export * from './line-ending.helper'; | ||
export * from './options.helper'; | ||
export * from './string.helper'; | ||
export * from './insert-code.helper'; |
Oops, something went wrong.