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

feat: syntax coloring #1

Closed
Tahul opened this issue Jul 4, 2021 · 7 comments · Fixed by nuxt-themes/docus#535 or #3
Closed

feat: syntax coloring #1

Tahul opened this issue Jul 4, 2021 · 7 comments · Fixed by nuxt-themes/docus#535 or #3

Comments

@Tahul
Copy link

Tahul commented Jul 4, 2021

Syntax coloring discussions should happen here. 😊

@farnabaz
Copy link
Collaborator

farnabaz commented Jul 5, 2021

# Imported from Slack conversation

highlighting optional Yaml data in the blew syntax seems impossible

::block-hero
data: yaml data
---
default slot
---title
The Jamstack Website Generator.
::

We use ending --- to detect wether above content should parse as Yaml data or not

But this kind of logic does not support in language grammars

They simply does not support backtracking, for simplicity and performance issues

An alternative would be to change data syntax to something like front matters syntax

::block-hero
---
data: yaml data
---
this will become default slot
---title
The Jamstack Website Generator.
::

Here is the proposal structure with coloring

Screen Shot 2021-07-02 at 7 14 59 PM

Copy link
Member

atinux commented Jul 5, 2021

I see, that makes total sense.

What about:

::block-hero
---
data: yaml data
---
[default] (optional)
This is the default slot
[title]
The Jamstack Website Generator.
::

Using [slot]\n to detect the slot might be easier and less confusing

@Tahul
Copy link
Author

Tahul commented Jul 5, 2021

Great idea; I also though that mixing the same syntax for props & slots was going to be confusing.

I like using [].

As we are delimitating content; I also though about this (unsure if possible):

::block-hero
---
data: yaml data
---

#default (optional)
This is the default slot

#title
The Jamstack Website Generator.

::

Note that # is the official shortcut for slots inside of Vue.

https://vuejs.org/v2/guide/components-slots.html#Named-Slots-Shorthand

Copy link
Member

atinux commented Jul 5, 2021

I like it even more 🔥

Would that be possible @farnabaz ?

@farnabaz
Copy link
Collaborator

farnabaz commented Jul 5, 2021

Absolutely 👍

@farnabaz
Copy link
Collaborator

farnabaz commented Jul 5, 2021

Screen Shot 2021-07-05 at 5 57 15 PM

I will create a PR for parser too

@ManUtopiK
Copy link

ManUtopiK commented May 11, 2022

Also, have you considerd the ugly markup with naive markdown parser caused by the ---?
I explain it in this issue docusgen/issues#8

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.

4 participants