Skip to content

Modify syntax for inline spans of text #20

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

Open
voltel opened this issue Jul 19, 2024 · 5 comments
Open

Modify syntax for inline spans of text #20

voltel opened this issue Jul 19, 2024 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@voltel
Copy link

voltel commented Jul 19, 2024

Is your feature request related to a problem? Please describe.
Currently, the syntax is limited in a way that css class can only be assigned to a chunk of text already delimited, e.g., by <strong>, <em> tags. As in the example below, it's currently impossible to apply a css class to a deliberate <span> of text—it has to be delimited by other markup.

I'm a **bold text `class: big`** and _`.small` me an italic one_

Describe the solution you'd like
Use the pipe character ("|") as a delimiter to separate metadata (including css classes information) from the text in the code blocks.
E.g.

For inline chunk of text:

The following code

I want this text to be in  `class: my-class another-class|a span with css classes` my-class and another-class

or its shorthand

I want this text to be in `.my-class another-class|a span with a css classes` my-class and another-class

should be rendered as

<p>I want this text to be in <span class="my-class another-class">a span with css classes</span> my-class and another-class</p>

For blocks of text:

Use a yaml metadata to describe the rendering instructions for the block.

The following markup

```
class: my-class another-class
---
I want this text to be in a div with a css classes my-class and another-class`
```

should be rendered as

<div class="my-class another-class">
<p>I want this text to be in a div with a css classes my-class and another-class</p>
</div>

or

```
class: my-class another-class
el: article
---
I want this text to be in a article html element with a css classes my-class and another-class`
```

should be rendered as

<article class="my-class another-class">
<p>I want this text to be in a div with a css classes my-class and another-class</p>
</article>

Additional context

Currently, the text is rendered using the <code> html tag.
A suggestion is to introduce inline yaml-like or css-like metadata in the code-block separated from the text with a pipe? E.g.:

This is a usual chunk of text `class: my-class another-class; el: kbd|Some text that I want to be rendered in a kbd html tag` and have custom classes assigned. 

rendered like the following:

<p>This is a usual chunk of text <kbd class="my-class another-class">Some text that I want to be rendered in a kbd html tag</kbd> and have custom classes assigned.</p>
@voltel voltel added the enhancement New feature or request label Jul 19, 2024
@Adam-Kay
Copy link

This is a good idea; I've been looking for this inline functionality also. Unfortunately, this repo is no longer maintained, so we will have to wait for someone to PR this.

@LilaRest
Copy link
Owner

Hey guys @Adam-Kay @voltel, I could also add you as maintainers of this repo. Let me know if that’s something you could be interested in.
Enjoy the rest of your day!

@Adam-Kay
Copy link

@LilaRest I'm okay with being added as a maintainer. I'm not super active but I could get around to implementing a couple things, this feature included

@voltel
Copy link
Author

voltel commented Sep 2, 2024 via email

@ksdavidc
Copy link

ksdavidc commented Mar 8, 2025

Just wanted to put in another vote for this. It would be very useful in my case, as I have special processing that happens in regular codeblocks, that I would like to also do to inline blocks, but it requires a class...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants