discourse/docs/developer-guides/lib/util.rb
Sérgio Saquetim 241c25ae27
DEV: Merge discourse-developer-docs into core (#37732)
- Import the full `discourse/discourse-developer-docs` repository into
`docs/developer-guides/` using `git subtree add` with complete git
history preserved
- Move CI workflows (lint + publish) from the nested `.github/` to
root-level workflows scoped to `docs/developer-guides/**` path changes
- The [developer-docs repo](https://github.com/discourse/discourse-developer-docs) was archived.
2026-02-11 20:38:08 -03:00

15 lines
325 B
Ruby

# frozen_string_literal: true
module Util
def self.parse_md(raw)
if match = raw.match(/\A---\s*\n(.+?)\n---\n?(.*)\z/m)
raw_frontmatter, content = match.captures
frontmatter = YAML.safe_load(raw_frontmatter)
else
content = raw
frontmatter = {}
end
[frontmatter, content]
end
end