feat: #8 config option to strip wrapping paragraphs#16
Conversation
✅ Deploy Preview for legendary-starlight-75451b ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
| eleventyConfig.addTransform('wcc', async (content, outputPath) => { | ||
| eleventyConfig.addTransform('wcc', async function (content, outputPath) { |
There was a problem hiding this comment.
Needed to change to anonymous function to support this
|
Hmm, I’ll have to look into this. It’s working fine on my machine. My guess is I have a different node or 11ty version installed.
edit: yup didn’t notice this was a node 14 project |
|
@thescientist13 Do you know why the CI keeps timing out? |
5e9d671 to
dd72d4b
Compare
There was a problem hiding this comment.
Thanks for this @KaiPrince !
Did just want to call out that the project is pretty far behind in dependencies (specifically 11ty and WCC) and so it still seemed prudent to do that first, which I have done in #17 .
One big benefit is that we can make this entire project ESM now. So if you want to check that one out, I would like to merge that one first probably
Interestingly, I don't see the wrapping <p> tags in the starter kit?
https://github.com/thescientist13/eleventy-starter-wcc
Also, and maybe because the local dev / node version was not defined in this repo, on main branch of this repo I was seeing the wrapping tags but nothing in the demo output. It seems the greeting.js file wasn't loading?

Probably still nice to have this feature though, so maybe after we land #17 , we can rebase and add this work.
Let me know your thoughts.
| { | ||
| "name": "eleventy-plugin-wcc", | ||
| "version": "0.1.0", | ||
| "version": "0.1.1", |
There was a problem hiding this comment.
we shouldn't be bumping package.json as part of PRs
| ## Options | ||
|
|
||
| Coming soon! | ||
| `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). |
There was a problem hiding this comment.
Interesting, for Greenwood we do it automatically. I guess it can't hurt to have it be an option
| @@ -0,0 +1,32 @@ | |||
| const parse5 = require('parse5'); | |||
There was a problem hiding this comment.
any reason we are using CJS here, and not ESM?
There was a problem hiding this comment.
oh right, 11ty didn't support ESM until v3
https://www.11ty.dev/blog/eleventy-v3/
| "scripts": { | ||
| "clean": "rimraf ./_site", | ||
| "lint": "eslint \"src/**/*.js\" \"demo/**/*.js\"", | ||
| "test": "jest", |
There was a problem hiding this comment.
could we just use node test runner here? Maybe we start with adding test cases for what's there currently as part of #3?
add markdown only check chore: add tests Add test for multiple components. switch to parse5 implementation inspired by https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454 Switch to node test runner remove jest revert version bump fix after rebase
dd72d4b to
7be1314
Compare
| "devDependencies": { | ||
| "@11ty/eleventy": "^3.1.0", | ||
| "eslint": "^8.18.0", | ||
| "parse5": "^8.0.0", |
There was a problem hiding this comment.
This should actually be a standard dependency, no?
| - name: Lint | ||
| run: | | ||
| npm run lint | ||
| - name: Test |

Summary
Adds a utility function to remove wrapping
<p>tags around custom elements for markdown files. Also added tests.Resolves #8 .