Remove ids from links

This commit is contained in:
Julien Bisconti 2018-06-08 19:38:46 +02:00
parent aca9367c69
commit c306007594
2 changed files with 4 additions and 19 deletions

View File

@ -2,7 +2,6 @@ const fs = require('fs');
const showdown = require('showdown');
const cheerio = require('cheerio');
const Parcel = require('parcel-bundler');
const camelCase = require('camelcase');
process.env.NODE_ENV = 'production';
@ -19,7 +18,7 @@ const includeReadme = ({
md = readme,
templateHTML = template,
dest = merged,
}) => {
} = {}) => {
const converter = new showdown.Converter({
omitExtraWLInCodeBlocks: true,
simplifiedAutoLink: true,
@ -48,19 +47,6 @@ const includeReadme = ({
console.log('Merging files...');
const $ = cheerio.load(indexTemplate);
$('#md').append(converter.makeHtml(markdown));
$('a').each((i, elem) => {
$(elem).attr(
'id',
camelCase(
$(elem)
.attr('href')
.replace(/\/|\.|:|#/g, ''),
{
pascalCase: true,
},
),
);
});
console.log('Writing index.html');
fs.writeFileSync(dest, $.html(), 'utf8');
console.log('DONE 👍');
@ -82,7 +68,7 @@ const bundle = (dest = destination) => {
};
const main = () => {
includeReadme({});
includeReadme();
bundle();
};

View File

@ -1,7 +1,7 @@
{
"name": "awesome-docker-website",
"version": "1.0.0",
"description": "> A curated list of Docker resources and projects Inspired by [@sindresorhus](https://github.com/sindresorhus)' [awesome][sindresorhus] and improved by these **[amazing contributors](https://github.com/veggiemonk/awesome-docker/graphs/contributors)**.",
"description": "A curated list of Docker resources and projects Inspired by @sindresorhus and improved by amazing contributors",
"main": "index.js",
"scripts": {
"build": "rimraf ./dist/ && node build.js",
@ -16,13 +16,12 @@
"url": "git+https://github.com/veggiemonk/awesome-docker.git"
},
"author": "Julien Bisconti <julien.bisconti at gmail dot com>",
"license": "MIT",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/veggiemonk/awesome-docker/issues"
},
"homepage": "https://github.com/veggiemonk/awesome-docker#readme",
"dependencies": {
"camelcase": "^5.0.0",
"cheerio": "^1.0.0-rc.2",
"critical": "^1.3.2",
"dayjs": "^1.6.4",