Skip to content

JS front-matter? #232

@Fil

Description

@Fil

We already have a profusion of languages (html, js, css, md), which are intertwined in a single document (not even counting data loaders or tex cells).

For front-matter we adopted yaml since it's the default in many static site generators, but it means that people have to learn yet another markup language, look up yet another reference. (I've also noticed that yaml in all its easiness is often a bit perplexing to users.) It's not a huge deal, since it's a very simple format, but would it make sense to remove it and express the front matter in javascript / typescript / json instead?

Another argument in favor of the change is that the config file must be js or ts, and shares its structure with the front-matter.

Keeping in mind that this informs the server, not the client, it would seem difficult to write it like this:

---js
const toc = false;
const title = "Welcome";
---

although, if we want to support server-side rendering of some elements (like tex #150), we'll need a way to specify that.

But there are other possibilities:

```js SSR
const config = {toc: false, title: "Welcome"};
```

or a config flag:

```js config
{toc: false, title: "Welcome"}
```

which accepts JSON but is functionally equivalent to

```js
export config = {toc: false, title: "Welcome"};
```

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions