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 .. && \
|
||||
npm install && \
|
||||
chmod u+x ./ssg5 && mkdir -p dst && \
|
||||
./ssg5 ./src/ ./dst/ "Le blog de Louis Vallat" "https://blog.louis-vallat.xyz" && rm dst/.files && \
|
||||
node ./enrich_codeblocks.js
|
||||
./ssg5 ./src/ ./dst/ "Le blog de Louis Vallat" "https://blog.louis-vallat.xyz" && rm dst/.files
|
||||
|
||||
FROM nginx
|
||||
|
||||
|
@ -8,15 +8,13 @@ loadLanguages([
|
||||
'rust', 'py', 'cpp', 'c', 'git'
|
||||
]);
|
||||
|
||||
fs.readdirSync("./dst/").filter(e => e.endsWith(".html")).forEach(file => {
|
||||
console.log("Enriching " + file)
|
||||
fsc.readFile("./dst/" + file).then(function ($) {
|
||||
$('*[class^="language-"]').replaceWith(function () {
|
||||
return $(this).html(Prism.highlight(
|
||||
$(this).text(),
|
||||
Prism.languages[$(this).attr('class').split('-')[1]])
|
||||
);
|
||||
});
|
||||
fsc.writeFile("./dst/" + file, $);
|
||||
const file = process.argv[2];
|
||||
fsc.readFile(file).then(function ($, err) {
|
||||
$('*[class^="language-"]').replaceWith(function () {
|
||||
return $(this).html(Prism.highlight(
|
||||
$(this).text(),
|
||||
Prism.languages[$(this).attr('class').split('-')[1]])
|
||||
);
|
||||
});
|
||||
fsc.writeFile(file, $);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user