diff --git a/blog/page-2.md b/blog/page-2.md index 93101f548..ccb34ca80 100644 --- a/blog/page-2.md +++ b/blog/page-2.md @@ -13,6 +13,8 @@ slugs: ## its a wild world after all +Link to [angular](http://angular.io){:target=\_blank} + ```typescript console.log('amazing'); ``` diff --git a/cypress/integration/sampleBlog.spec.js b/cypress/integration/sampleBlog.spec.js index 3934b5df8..be15e15e9 100644 --- a/cypress/integration/sampleBlog.spec.js +++ b/cypress/integration/sampleBlog.spec.js @@ -53,11 +53,16 @@ context('check first integration test', () => { .should('have', 'posts'); }); + it('check link to have target_blank in blog page 2', () => { + cy.visit('/blog/___UNPUBLISHED___k5nhcflm_SJwD4Z0QDrIHg1PGHo2mrfLZE8sfUsPy/'); + + cy.get('a[target]').should('have.attr', 'target', '_blank'); + }); + it('Check that the slow user mock template appears then disappears', () => { cy.visit('/slow').reload(); cy.get('app-slow>h1').contains('Scully Not Generated'); - console.log('HERE'); cy.wait(4100) .get('app-slow>h1') .contains('Scully Generated'); diff --git a/projects/scullyio/ng-lib/package.json b/projects/scullyio/ng-lib/package.json index 77b70ab80..e45b46ad8 100644 --- a/projects/scullyio/ng-lib/package.json +++ b/projects/scullyio/ng-lib/package.json @@ -1,6 +1,6 @@ { "name": "@scullyio/ng-lib", - "version": "0.0.21", + "version": "0.0.22", "repository": { "type": "GIT", "url": "https://github.com/scullyio/scully/tree/master/projects/scullyio/ng-lib" diff --git a/scully/package.json b/scully/package.json index 8275e3ccc..c7fef8d4f 100644 --- a/scully/package.json +++ b/scully/package.json @@ -1,6 +1,6 @@ { "name": "@scullyio/scully", - "version": "0.0.81", + "version": "0.0.83", "description": "Scully CLI", "repository": { "type": "GIT", diff --git a/scully/pluginManagement/systemPlugins.ts b/scully/pluginManagement/systemPlugins.ts index 53215d016..66517ca41 100644 --- a/scully/pluginManagement/systemPlugins.ts +++ b/scully/pluginManagement/systemPlugins.ts @@ -6,3 +6,4 @@ import '../routerPlugins/defaultRouterPlugin'; import '../routerPlugins/ignoredRoutePlugin'; import '../routerPlugins/jsonRoutePlugin'; import '../renderPlugins/seoHrefCompletionPlugin'; +import '../renderPlugins/customMarkdownOptions'; diff --git a/scully/renderPlugins/contentRenderPlugin.ts b/scully/renderPlugins/contentRenderPlugin.ts index 7e5203720..15262c908 100644 --- a/scully/renderPlugins/contentRenderPlugin.ts +++ b/scully/renderPlugins/contentRenderPlugin.ts @@ -6,6 +6,7 @@ import {handleFile} from './content-render-utils/handleFile'; import {insertContent} from './content-render-utils/insertContent'; import {readFileAndCheckPrePublishSlug} from './content-render-utils/readFileAndCheckPrePublishSlug'; import {JSDOM} from 'jsdom'; +import {customMarkdownOptions} from './customMarkdownOptions'; registerPlugin('render', 'contentFolder', contentRenderPlugin); @@ -24,7 +25,7 @@ export async function contentRenderPlugin(html: string, route: HandledRoute) { .split('>')[0] .trim() ); - const additionalHTML = await handleFile(extension, fileContent); + const additionalHTML = await customMarkdownOptions(await handleFile(extension, fileContent)); const htmlWithNgAttr = addNgIdAttribute(additionalHTML, attr); return insertContent(scullyBegin, scullyEnd, html, htmlWithNgAttr, getScript(attr)); } catch (e) { diff --git a/scully/renderPlugins/customMarkdownOptions.ts b/scully/renderPlugins/customMarkdownOptions.ts new file mode 100644 index 000000000..27e33e611 --- /dev/null +++ b/scully/renderPlugins/customMarkdownOptions.ts @@ -0,0 +1,8 @@ +export const customMarkdownOptions = (html: string) => { + return html.replace(/\]*\>[^<]*\<\/a\>\{[^}]*\}/g, (val, pos) => { + const [start, rest] = val.split('{:'); + const injectStr = rest.slice(0, -1); + const [initial, end] = start.split('href='); + return `${initial} ${injectStr} href=${end}`; + }); +};