Skip to content

Commit dd72d4b

Browse files
committed
add trimParagraphTagsInMd option to disable fix
1 parent 29b31a5 commit dd72d4b

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,6 @@ Now if you run `eleventy`, you should get an _index.html_ in your _site/_ direct
102102

103103
## Options
104104

105-
Coming soon!
105+
`trimParagraphTagsInMd` (bool, default true) - Trims unexpected `<p>` tags that markdown puts around custom elements [more details](https://github.com/ProjectEvergreen/eleventy-plugin-wcc/issues/8).
106106

107107
> _Please follow along in our [issue tracker](https://github.com/ProjectEvergreen/eleventy-plugin-wcc/issues) or make a suggestion!_

src/index.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const { stripWrappingParagraphs } = require('./utils');
33

44
module.exports = {
55
configFunction: function (eleventyConfig, options = {}) {
6-
const { definitions = [] } = options;
6+
const { definitions = [], trimParagraphTagsInMd = true } = options;
77
const definitionPathnames = definitions.map(definition => definition.pathname);
88

99
for (const definition of definitions) {
@@ -15,9 +15,10 @@ module.exports = {
1515
return;
1616
}
1717

18-
const processedContent = this.inputPath.endsWith('.md')
19-
? stripWrappingParagraphs(content)
20-
: content;
18+
const processedContent =
19+
trimParagraphTagsInMd && this.inputPath.endsWith('.md')
20+
? stripWrappingParagraphs(content)
21+
: content;
2122

2223
const { html } = await renderFromHTML(processedContent, definitions);
2324
return html;

0 commit comments

Comments
 (0)