|
1
|
const HEADING_REGEX = /# (?<title>.*)/ |
|
2
|
|
|
3
|
/** |
|
4
|
* |
|
5
|
* @param {string} content - The content to search |
|
6
|
* @returns {string | undefined} |
|
7
|
*/ |
|
8
|
export default function findPageHeading(content) { |
|
9
|
const headingMatch = HEADING_REGEX.exec(content) |
|
10
|
|
|
11
|
return headingMatch?.groups?.title |
|
12
|
} |