Skip to content

Commit

Permalink
handle string replace replacement patterns breaking markdown renderin…
Browse files Browse the repository at this point in the history
…g with in it (#1127)
  • Loading branch information
thescientist13 authored Aug 3, 2023
1 parent 04c3eaf commit cd3a186
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/cli/src/plugins/resource/plugin-standard-html.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ class StandardHtmlResource extends ResourceInterface {
});
}

body = body.replace(/\<content-outlet>(.*)<\/content-outlet>/s, processedMarkdown.contents);
// https://github.com/ProjectEvergreen/greenwood/issues/1126
body = body.replace(/\<content-outlet>(.*)<\/content-outlet>/s, processedMarkdown.contents.replace(/\$/g, '$$$'));
} else if (matchingRoute.external) {
body = body.replace(/\<content-outlet>(.*)<\/content-outlet>/s, matchingRoute.body);
} else if (ssrBody) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,15 @@ describe('Build Greenwood With: ', function() {
dom = await JSDOM.fromFile(path.resolve(this.context.publicDir, 'index.html'));
});

it('should correctly rendering an <h3> tag', function() {
// https://github.com/ProjectEvergreen/greenwood/issues/1126
it('should correctly render an <h2> tag with a $1 in the text content', function() {
const heading = dom.window.document.querySelectorAll('body h2');

expect(heading.length).to.equal(1);
expect(heading[0].textContent).to.equal('Posters $10');
});

it('should correctly render an <h3> tag', function() {
const heading = dom.window.document.querySelectorAll('body h3');

expect(heading.length).to.equal(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
title: 'this is a custom markdown title'
---

## Posters $10

### Greenwood Markdown Test

This is some markdown being rendered by Greenwood.
Expand Down

0 comments on commit cd3a186

Please sign in to comment.