Files are enriched in ssg5 as they are parsed instead of doing it in 2 steps
Signed-off-by: Louis Vallat <louis@louis-vallat.xyz>
This commit is contained in:
parent
b112eae79f
commit
3bcd9c4e00
@ -9,8 +9,7 @@ RUN apk --no-cache add gcc git make musl-dev npm && \
|
|||||||
cd lowdown && ./configure && make && make regress && make install && cd .. && \
|
cd lowdown && ./configure && make && make regress && make install && cd .. && \
|
||||||
npm install && \
|
npm install && \
|
||||||
chmod u+x ./ssg5 && mkdir -p dst && \
|
chmod u+x ./ssg5 && mkdir -p dst && \
|
||||||
./ssg5 ./src/ ./dst/ "Le blog de Louis Vallat" "https://blog.louis-vallat.xyz" && rm dst/.files && \
|
./ssg5 ./src/ ./dst/ "Le blog de Louis Vallat" "https://blog.louis-vallat.xyz" && rm dst/.files
|
||||||
node ./enrich_codeblocks.js
|
|
||||||
|
|
||||||
FROM nginx
|
FROM nginx
|
||||||
|
|
||||||
|
@ -8,15 +8,13 @@ loadLanguages([
|
|||||||
'rust', 'py', 'cpp', 'c', 'git'
|
'rust', 'py', 'cpp', 'c', 'git'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
fs.readdirSync("./dst/").filter(e => e.endsWith(".html")).forEach(file => {
|
const file = process.argv[2];
|
||||||
console.log("Enriching " + file)
|
fsc.readFile(file).then(function ($, err) {
|
||||||
fsc.readFile("./dst/" + file).then(function ($) {
|
$('*[class^="language-"]').replaceWith(function () {
|
||||||
$('*[class^="language-"]').replaceWith(function () {
|
return $(this).html(Prism.highlight(
|
||||||
return $(this).html(Prism.highlight(
|
$(this).text(),
|
||||||
$(this).text(),
|
Prism.languages[$(this).attr('class').split('-')[1]])
|
||||||
Prism.languages[$(this).attr('class').split('-')[1]])
|
);
|
||||||
);
|
|
||||||
});
|
|
||||||
fsc.writeFile("./dst/" + file, $);
|
|
||||||
});
|
});
|
||||||
|
fsc.writeFile(file, $);
|
||||||
});
|
});
|
||||||
|
1
ssg5
1
ssg5
@ -194,6 +194,7 @@ render_md_files_lowdown() {
|
|||||||
--html-no-skiphtml \
|
--html-no-skiphtml \
|
||||||
--html-no-escapehtml < "$1/$f" |
|
--html-no-escapehtml < "$1/$f" |
|
||||||
render_html_file "$3" "$(head -n 3 ${1}/${f} | tail -n 1)" > "$2/${f%\.md}.html"
|
render_html_file "$3" "$(head -n 3 ${1}/${f} | tail -n 1)" > "$2/${f%\.md}.html"
|
||||||
|
node ./enrich_codeblocks.js "$2/${f%\.md}.html"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user