Skip to content

Commit

Permalink
[#64933] fix headings
Browse files Browse the repository at this point in the history
  • Loading branch information
Trzcin committed Sep 18, 2024
1 parent c1bc868 commit 78f4d10
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/extensions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { suggestionPopup } from "./suggestions";
import { foldEffect, unfoldEffect, foldable } from "@codemirror/language";
import { syncPreviewWithCursor, syncPreviewWithEditorScroll } from "./syncDualPane";
import { cursorIndicator } from "./cursorIndicator";
import { customCommonMark } from "./markdownLang";
import { customCommonMark, headerIndent } from "./markdownLang";

const basicSetupWithoutHistory = basicSetup.filter((_, i) => i != 3);
const minimalSetupWithoutHistory = minimalSetup.filter((_, i) => i != 1);
Expand Down Expand Up @@ -54,6 +54,7 @@ export class ExtensionBuilder {
EditorView.lineWrapping,
markdown({ base: customCommonMark }),
highlightActiveLine(),
headerIndent,
keymap.of([indentWithTab, { key: "Mod-Z", run: redo }]),
];
}
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/markdownLang.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function isHeading(type) {
return match ? +match[1] : undefined;
}

const headerIndent = foldService.of((state, start, end) => {
export const headerIndent = foldService.of((state, start, end) => {
for (let node = syntaxTree(state).resolveInner(end, -1); node; node = node.parent) {
if (node.from < start) break;
let heading = node.type.prop(headingProp);
Expand Down

0 comments on commit 78f4d10

Please sign in to comment.