Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong fontification of indented YAML and TOML metadata #476

Closed
saf-dmitry opened this issue May 6, 2020 · 0 comments
Closed

Wrong fontification of indented YAML and TOML metadata #476

saf-dmitry opened this issue May 6, 2020 · 0 comments

Comments

@saf-dmitry
Copy link
Contributor

Indended statements in YAML and TOML metadata blocks

---
references:
- type: article-journal
  id: WatsonCrick1953
  author:
  - family: Watson
    given: J. D.
  - family: Crick
    given: F. H. C.
  issued:
    date-parts:
    - - 1953
      - 4
      - 25
  title: 'Molecular structure of nucleic acids: a structure for deoxyribose
    nucleic acid'
---

are not fontified as such.

Software Versions

  • Markdown Mode: From Git on 2020-05-06
  • Emacs: 26.3
  • OS: macOS 10.14.6

Solution

Since both YAML and TOML metadata statements can be indented using tabs and/or spaces (common in YAML to indicate nesting, allowed, but not required in TOML), the regexp markdown-regex-declarative-metadata should be modified as follows to allow tabs and/or spaces at BOL:

(defconst markdown-regex-declarative-metadata
  "^[ \t]*\\([[:alpha:]][[:alpha:] _-]*?\\)\\([:=][ \t]*\\)\\(.*\\)$"
  "Regular expression for matching declarative metadata statements.
This matches MultiMarkdown metadata as well as YAML and TOML
assignments such as the following:

    variable: value

or

    variable = value")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants