(readme, sectionName, isToc = false)
| 132 | return fenceContent; |
| 133 | } |
| 134 | function getFenceForSection(readme, sectionName, isToc = false) { |
| 135 | try { |
| 136 | let fence = getFence(sectionName, isToc); |
| 137 | let regex = new RegExp(`(${fence.start}[\\s\\S]+${fence.end})`, "gm"); |
| 138 | return { regex: regex, content: regex.exec(readme.content) }; |
| 139 | } catch (err) { |
| 140 | console.error( |
| 141 | `🚨 You've encountered a ${err.name} ➜ ${err.message} \n` + |
| 142 | `💡 ProTip ➜ Please ensure the comments exist and are separated by a newline.` |
| 143 | ); |
| 144 | |
| 145 | console.error({ readme, sectionName }); |
| 146 | console.error(err); |
| 147 | } |
| 148 | } |
| 149 | function getFence(sectionName, isToc = false) { |
| 150 | let name = isToc ? sectionName + "-toc" : sectionName; |
| 151 | let START_COMMENT = "<!--START-SECTION:" + name + "-->"; |
no test coverage detected