Skip to content

Add plugin for simple inline text styling #139

Open

Description

@xMrAfonso

It would be useful to support lightweight text styling directly in Markdown without falling back to HTML.

Proposed syntax:

[text]{color=#ff00ff | font=Poppins}

Examples:

Hello [world]{color=#ff00ff}
[Important]{color=red | weight=bold}
[Code]{font=monospace | bg=#f5f5f5}

Why this helps:

  • Keeps Markdown clean and readable
  • Avoids inline HTML
  • Easy to extend with more properties later
  • Simple to parse and implement

Supported properties (initial):

  • color, bg
  • font, size
  • weight, style

This could be implemented as an optional plugin that converts the syntax into a <span style="..."> under the hood.

Happy to help with implementation if this direction makes sense.

Activity

  1. farnabaz commented on Apr 21, 2026

    @farnabaz
    Collaborator

    This syntax is already supported in Comark and you can create span using [content]{attributes} syntax. Checkout https://comark.dev/syntax/attributes#span-attributes

    There is not alias for styling to fonts, you can simply pass class, id, styles or any html attribute to span elements.

    [Code]{style="background: #f5f5f5"}
    
  2. xMrAfonso commented on Apr 21, 2026

    @xMrAfonso
    ContributorAuthor

    Oh interesting, I somehow missed that. Thanks @farnabaz !

    How does this work in terms of security and limiting. For instance, if I allow user generated content, then I want to limit which attributes they can use. Additionally, would also like to limit use of url(), etc to avoid injections.

  3. xMrAfonso commented on Apr 21, 2026

    @xMrAfonso
    ContributorAuthor

    I just had a deeper look at attributes.

    They are quite cool, but it gives more power than it should. I am proposing for a styling only specific syntax/plugin.

    The current syntax for styling something would be essentially inline css, which is both annoying and may be unwanted by administrators/devs which only want to give users very limited and specific power.

  4. atinux commented on Apr 22, 2026

    @atinux
    Contributor

    Hey @xMrAfonso

    I can see it as a community plugin at first, if you want to create one and publish it as comark-plugin-text-styling for example, I would be happy to add a Community Plugins section to list it 😊

    How does this work in terms of security and limiting. For instance, if I allow user generated content, then I want to limit which attributes they can use. Additionally, would also like to limit use of url(), etc to avoid injections.

    This is a very good comment and I believe we could also improve the Security Plugin in this area

  5. xMrAfonso commented on Apr 22, 2026

    @xMrAfonso
    ContributorAuthor

    Hey @atinux

    Yeah, would gladly do one when I have some free time.

    I was actually also looking into adding a plugin that adds support for minimessage-js. Looks like a cool syntax, specially the way it handles colors.

    Regarding the improvement, I would really love if there were more configurations into core features like being able to disable attributes fully without having to configure the security plugin...

  6. xMrAfonso commented on Apr 30, 2026

    @xMrAfonso
    ContributorAuthor

    Hey @atinux,

    Played around a bit with the initial proposal and noticed it was trying to cover too much. So, I choose to just go with just text coloring in specific.

    I created this quick demo to show how it would work (thanks codex)

    Would there be interest in making this an official plugin or should I continue the community plugin route?

  7. xMrAfonso commented on May 18, 2026

    @xMrAfonso
    ContributorAuthor

    Could I get a potential update on this?

  8. atinux commented on Jun 11, 2026

    @atinux
    Contributor

    Sorry about not answering before @xMrAfonso, I found the demo nice! I think a community plugin to start would be great! Would you need help somehow for a comark plugin starter repo maybe?

  9. xMrAfonso commented on Jun 11, 2026

    @xMrAfonso
    ContributorAuthor

    @atinux I mean, if there is a standard structure/template you'd prefer for me to use, sure. Otherwise I can look into it.

  10. atinux commented on Jun 13, 2026

    @atinux
    Contributor

    We don't at the moment but I think you can use something like https://tsdown.dev/guide/getting-started#starter-templates

  11. farnabaz commented on Jun 18, 2026

    @farnabaz
    Collaborator

    @xMrAfonso we just created a plugin template, you can use this template to create and publish your plugin.

    Checkout: https://github.com/comarkdown/comark-plugin-template

  12. xMrAfonso commented on Jun 18, 2026

    @xMrAfonso
    ContributorAuthor

    @xMrAfonso we just created a plugin template, you can use this template to create and publish your plugin.

    Checkout: https://github.com/comarkdown/comark-plugin-template

    Hey, did you by any chance read the rest of the conversation? You suggested that already and I already explained it is not what I am speaking about nor use case.

  13. farnabaz commented on Jun 18, 2026

    @farnabaz
    Collaborator

    @xMrAfonso What is your goal and use case? I don't see this feature as part of Comark core and it can be a community plugin and documented in docs.

  14. xMrAfonso commented on Jun 18, 2026

    @xMrAfonso
    ContributorAuthor

    @farnabaz yes, that has been mentioned already and is the current plan.

    In terms of goal, the demo I have sent shows a pretty good example, which is firstly usability/user experience for coloring texts. And secondly meant to be used in user generated contexts

  15. farnabaz commented on Jun 18, 2026

    @farnabaz
    Collaborator

    @farnabaz yes, that has been mentioned already and is the current plan.

    In terms of goal, the demo I have sent shows a pretty good example, which is firstly usability/user experience for coloring texts. And secondly meant to be used in user generated contexts

    Indeed I saw your demo. I agree with rest of conversation and just sent you a plugin starter, it is your decision to use or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions