Skip to content

Commit

Permalink
fix: escape_code option
Browse files Browse the repository at this point in the history
  • Loading branch information
TOsmanov committed Dec 10, 2024
1 parent 7ea97b7 commit 27ce384
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions linter.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,10 +386,15 @@ function execute (command, verbose = false, debug = false, allowFailure = false,

function createConfigIncludesMap (foliantConfig) {
/* eslint-disable no-useless-escape */
const onlyIncludesMapConf = `title: !include ${foliantConfig}#title
chapters: !include ${foliantConfig}#chapters
escape_code: !include ${foliantConfig}#escape_code
preprocessors:
const content = fs.readFileSync(foliantConfig)
const onlyIncludesMapConf = []
onlyIncludesMapConf.push(`title: !include ${foliantConfig}#title
chapters: !include ${foliantConfig}#chapters`)
if (content.includes('escape_code:')) {
onlyIncludesMapConf.push(`escape_code: !include ${foliantConfig}#escape_code`)
}

onlyIncludesMapConf.push(`preprocessors:
- includes:
includes_map:
- anchors
Expand All @@ -400,10 +405,9 @@ preprocessors:
- pre
backend_config:
pre:
slug: temp_project
`
slug: temp_project`)
/* eslint-enable no-useless-escape */
fs.writeFileSync(usedFoliantConfig, onlyIncludesMapConf, (err) => {
fs.writeFileSync(usedFoliantConfig, onlyIncludesMapConf.join('\n'), (err) => {
if (err) {
console.error(err)
return
Expand Down

0 comments on commit 27ce384

Please sign in to comment.