Skip to content

Commit

Permalink
update highlight
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenjoezhang committed Jan 1, 2023
1 parent aa6bc6a commit 7854208
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 3 deletions.
13 changes: 11 additions & 2 deletions lib/extend/syntax_highlight.js → lib/extend/syntax_highlight.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
'use strict';
interface StoreFunction {
(...args: any[]): any;
priority?: number;
}

interface Store {
[key: string]: StoreFunction[]
}

class SyntaxHighlight {
public store: Store;

constructor() {
this.store = {};
}
Expand All @@ -26,4 +35,4 @@ class SyntaxHighlight {
}
}

module.exports = SyntaxHighlight;
export = SyntaxHighlight;
9 changes: 8 additions & 1 deletion lib/plugins/filter/before_post_render/backtick_code_block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ const rLangCaption = /([^\s]+)\s*(.+)?/;

const escapeSwigTag = str => str.replace(/{/g, '{').replace(/}/g, '}');

interface Options {
lang: string,
caption: string,
lines_length: number,
firstLineNumber?: string | number
}

export = ctx => {
return function backtickCodeBlock(data) {
const dataContent = data.content;
Expand Down Expand Up @@ -44,7 +51,7 @@ export = ctx => {
content = content.replace(regexp, '');
}

const options = {
const options: Options = {
lang,
caption,
lines_length: content.split('\n').length
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 7854208

Please sign in to comment.