fix: Images in lists on shared documents sometimes render as code blocks
This commit is contained in:
@@ -62,6 +62,7 @@ export class MarkdownSerializer {
|
||||
// node and mark serialization methods (see `toMarkdown`).
|
||||
export class MarkdownSerializerState {
|
||||
inTable = false;
|
||||
inList = false;
|
||||
inTightList = false;
|
||||
closed = false;
|
||||
delim = "";
|
||||
|
||||
@@ -297,7 +297,11 @@ export default class Image extends SimpleImage {
|
||||
);
|
||||
|
||||
toMarkdown(state: MarkdownSerializerState, node: ProsemirrorNode) {
|
||||
let markdown =
|
||||
// Skip the preceding space for images at the start of a list item or Markdown parsers may
|
||||
// render them as code blocks
|
||||
let markdown = state.inList ? "" : " ";
|
||||
|
||||
markdown +=
|
||||
"![" +
|
||||
state.esc((node.attrs.alt || "").replace("\n", "") || "", false) +
|
||||
"](" +
|
||||
|
||||
Reference in New Issue
Block a user