2024-04-05 13:16:49 +02:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
2020-11-12 21:13:28 +02:00
|
|
|
function plugin(markdownIt: any) {
|
2020-01-30 23:05:23 +02:00
|
|
|
const defaultRender =
|
|
|
|
markdownIt.renderer.rules.code_inline ||
|
2024-04-05 13:16:49 +02:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
2020-11-12 21:13:28 +02:00
|
|
|
function(tokens: any, idx: any, options: any, _env: any, self: any) {
|
2020-01-30 23:05:23 +02:00
|
|
|
return self.renderToken(tokens, idx, options);
|
|
|
|
};
|
|
|
|
|
2024-04-05 13:16:49 +02:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
2020-11-12 21:13:28 +02:00
|
|
|
markdownIt.renderer.rules.code_inline = (tokens: any[], idx: number, options: any, env: any, self: any) => {
|
2020-01-30 23:05:23 +02:00
|
|
|
const token = tokens[idx];
|
|
|
|
let tokenClass = token.attrGet('class');
|
|
|
|
if (!tokenClass) tokenClass = '';
|
|
|
|
tokenClass += ' inline-code';
|
|
|
|
token.attrSet('class', tokenClass.trim());
|
|
|
|
return defaultRender(tokens, idx, options, env, self);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2020-10-21 01:23:55 +02:00
|
|
|
export default {
|
|
|
|
plugin,
|
2020-01-30 23:05:23 +02:00
|
|
|
};
|