easy-markdown-editor icon indicating copy to clipboard operation
easy-markdown-editor copied to clipboard

EasyMDE applies Setext heading markdown format styling to YAML front matter

Open Alyw234237 opened this issue 3 years ago • 1 comments

Describe the bug

EasyMDE applies markdown format styling (specifically Setext-style headings) to YAML front matter.

To reproduce

Put the following text into an EasyMDE editor instance:

---
title: Put article title here
author: Jane Doe
date: 8 December 2021
category: articles
---

Article content goes here. [...]

The category: articles\n--- lines will have heading styling applied due to the closing ---. Screenshot provided below.

Expected behavior

EasyMDE will detect YAML front matter and not apply markdown styling to it. An alternative solution could be to apply markdown heading styling via Setext-style headings (---) only if the line preceding the heading text is blank; i.e.:


Heading text
---

Screenshot

Version information

  • OS: Windows 10
  • Browser: Google Chrome 96
  • EasyMDE version: v2.15.0 (current latest)

Alyw234237 avatar Dec 08 '21 17:12 Alyw234237

I made a pull request for this called extractYaml https://github.com/Ionaru/easy-markdown-editor/pull/494 since I needed it too. If you guys have any better option name please suggest.

In your use case, did you want to keep the yaml in preview?

Cause maybe yaml-frontmatter could just be default then extractYaml only removes it from preview.

faisalraja avatar Aug 24 '22 23:08 faisalraja