mirror of
https://github.com/all-contributors/cli.git
synced 2025-01-09 13:36:29 +00:00
feat: adapt to rst (#301)
Co-authored-by: Maximilian Berkmann <maxieberkmann@gmail.com> Co-authored-by: Angel Aviel Domaoan <13580338+tenshiAMD@users.noreply.github.com>
This commit is contained in:
parent
8db67102cb
commit
7a9150fa52
1 changed files with 14 additions and 2 deletions
|
@ -24,11 +24,17 @@ function injectListBetweenTags(newContent) {
|
|||
) {
|
||||
return previousContent
|
||||
}
|
||||
const startIndent = Math.max(
|
||||
0,
|
||||
previousContent.lastIndexOf('\n', startOfOpeningTagIndex),
|
||||
)
|
||||
const nbSpaces =
|
||||
startOfOpeningTagIndex - Math.min(startOfOpeningTagIndex, startIndent)
|
||||
return [
|
||||
previousContent.slice(0, endOfOpeningTagIndex + closingTag.length),
|
||||
'\n<!-- prettier-ignore-start -->',
|
||||
'\n<!-- markdownlint-disable -->',
|
||||
newContent,
|
||||
newContent.replace('\n', `\n${' '.repeat(nbSpaces - 1)}`),
|
||||
'<!-- markdownlint-restore -->',
|
||||
'\n<!-- prettier-ignore-end -->',
|
||||
'\n\n',
|
||||
|
@ -85,10 +91,16 @@ function replaceBadge(newContent) {
|
|||
) {
|
||||
return previousContent
|
||||
}
|
||||
const startIndent = Math.max(
|
||||
0,
|
||||
previousContent.lastIndexOf('\n', startOfOpeningTagIndex),
|
||||
)
|
||||
const nbSpaces =
|
||||
startOfOpeningTagIndex - Math.min(startOfOpeningTagIndex, startIndent)
|
||||
return [
|
||||
previousContent.slice(0, endOfOpeningTagIndex + closingTag.length),
|
||||
'\n',
|
||||
newContent,
|
||||
newContent.replace('\n', `\n${' '.repeat(nbSpaces)}`),
|
||||
'\n',
|
||||
previousContent.slice(startOfClosingTagIndex),
|
||||
].join('')
|
||||
|
|
Loading…
Reference in a new issue