mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-27 06:57:57 +02:00
parent
d2d3ace924
commit
f72df94dd3
1 changed files with 2 additions and 2 deletions
|
@ -73,7 +73,7 @@ function readSidebar() {
|
||||||
function splitHeader(content) {
|
function splitHeader(content) {
|
||||||
const lines = content.split("\n");
|
const lines = content.split("\n");
|
||||||
if (lines[0] !== "---") {
|
if (lines[0] !== "---") {
|
||||||
return false;
|
return {};
|
||||||
}
|
}
|
||||||
let i = 1;
|
let i = 1;
|
||||||
for (; i < lines.length - 1; ++i) {
|
for (; i < lines.length - 1; ++i) {
|
||||||
|
@ -91,7 +91,7 @@ function splitHeader(content) {
|
||||||
function extractMetadata(content) {
|
function extractMetadata(content) {
|
||||||
const metadata = {};
|
const metadata = {};
|
||||||
const both = splitHeader(content);
|
const both = splitHeader(content);
|
||||||
if (both === false) {
|
if (Object.keys(both).length === 0) {
|
||||||
return { metadata, rawContent: content };
|
return { metadata, rawContent: content };
|
||||||
}
|
}
|
||||||
const lines = both.header.split("\n");
|
const lines = both.header.split("\n");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue