Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion projects/scullyio/ng-lib/package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion scully/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@scullyio/scully",
"version": "0.0.81",
"version": "0.0.83",
"description": "Scully CLI",
"repository": {
"type": "GIT",
Expand Down
1 change: 1 addition & 0 deletions scully/pluginManagement/systemPlugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ import '../routerPlugins/defaultRouterPlugin';
import '../routerPlugins/ignoredRoutePlugin';
import '../routerPlugins/jsonRoutePlugin';
import '../renderPlugins/seoHrefCompletionPlugin';
import '../renderPlugins/customMarkdownOptions';
3 changes: 2 additions & 1 deletion scully/renderPlugins/contentRenderPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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) {
Expand Down
28 changes: 28 additions & 0 deletions scully/renderPlugins/customMarkdownOptions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
export const customMarkdownOptions = (html: string) => {
return html.replace(/\<a[^>]*\>[^<]*\<\/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}`;
});
};

Comment thread
SanderElias marked this conversation as resolved.
Outdated
// const test = `
// sdfoasjdfkl sakdfjas lkdf;askdjf as;djf asldkjf
// <a href="url">link</a>{:target="_blank" class="pepe"}
// SOME BULLSHIT STARTING TEXT
// <a href="bar">foo</a>{:target="_blank"}
// BS MIDDLE TEXT
// <a href="bar">foo</a>{:target="_blank"}
// END TEXT

// SOME BULLSHIT STARTING TEXT
// <a href="bar">foo</a>{:target="_blank"}
// BS MIDDLE TEXT
// <a href="bar">foo</a>{:target="_blank"}
// END TEXT
// `

// customMarkdownOptions(test); //?

// registerPlugin('render','customMarkdownOptions', customMarkdownOptions)