一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
23 行
1.1 KiB
TypeScript
23 行
1.1 KiB
TypeScript
import type * as MarkdownIt from 'markdown-it';
|
|
import type * as Renderer from 'markdown-it/lib/renderer';
|
|
import defaultRule from './utils/defaultRule';
|
|
|
|
export default {
|
|
// Make table horizontally scrollable by give table a div parent, so the width of the table is limited to the screen width.
|
|
// see https://github.com/laurent22/joplin/pull/10161
|
|
plugin: (markdownIt: MarkdownIt) => {
|
|
const defaultTableOpen = defaultRule(markdownIt, 'table_open');
|
|
markdownIt.renderer.rules.table_open = function(tokens: MarkdownIt.Token[], idx: number, options: MarkdownIt.Options, env: unknown, renderer: Renderer) {
|
|
const current = defaultTableOpen(tokens, idx, options, env, renderer);
|
|
// joplin-table-wrapper css is set in packages/renderer/noteStyle.ts
|
|
return `<div class="joplin-table-wrapper">\n${current}`;
|
|
};
|
|
|
|
const defaultTableClose = defaultRule(markdownIt, 'table_close');
|
|
markdownIt.renderer.rules.table_close = function(tokens: MarkdownIt.Token[], idx: number, options: MarkdownIt.Options, env: unknown, renderer: Renderer) {
|
|
const current = defaultTableClose(tokens, idx, options, env, renderer);
|
|
return `${current}</div>\n`;
|
|
};
|
|
},
|
|
};
|