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

Support for custom CSS #12

Open
fresh2dev opened this issue Jul 26, 2023 · 9 comments
Open

Support for custom CSS #12

fresh2dev opened this issue Jul 26, 2023 · 9 comments

Comments

@fresh2dev
Copy link

Termynal can be customized quite heavily with CSS alone.

For example, I replace the MacOS-like modal buttons with standard '- ⛶ X' text.

And I replace the title "bash", with plain "shell".

And if the language is "powershell", I set the prefix to 'PS >'.

Similarly, for "python", the prefix is '>>>'.

Rather than baking all this into this tool, if this tool could allow me to point to a custom CSS file, it would simplify the Termynal-related markdown I maintain today.

@daxartio
Copy link
Collaborator

Would you like to use your css file instead of Termynal's?

@daxartio
Copy link
Collaborator

For example, I replace the MacOS-like modal buttons with standard '- ⛶ X' text.

And I replace the title "bash", with plain "shell".

And if the language is "powershell", I set the prefix to 'PS >'.

Similarly, for "python", the prefix is '>>>'.

I can add settings for this cases and you don't need to use your css

@fresh2dev
Copy link
Author

I was thinking support for external CSS files would provide the capability without so much development burden. If you can elegantly bake all that into this tool, that'd be awesome too 🤘

@daxartio
Copy link
Collaborator

daxartio commented Jul 31, 2023

You can try to apply this configuration in 0.7.0.a1

markdown_extensions:
  - termynal:
      title: "powershell"
      prompt_literal_start:
        - "$"
        - "PS >"  # later it will be "PS >"
        - ">>>"
<!-- termynal -->

```
PS > pip install termynal
---> 100%
Installed
```

Also in the future i will try to add a configuration like this for each code block.

<!-- termynal :: title:"shell" :: prompt_literal_start:["$", ">>>"] -->

For example, I replace the MacOS-like modal buttons with standard '- ⛶ X' text.

It will be later

@fresh2dev
Copy link
Author

That's dope! Yeah, being able to configure each prompt is essential, as a bash-, powershell-, or python-termynal could all exist in the same page.

Thank you!

@daxartio
Copy link
Collaborator

daxartio commented Aug 1, 2023

I added new feature in v0.9.0.

You can override configs for each block. If you set a part of the settings, another part will be set to the default value.

<!-- termynal: {"prompt_literal_start": ["$", ">>>", "PS >"], title: shell} -->

```
PS > python
>>> import json
```

@fresh2dev
Copy link
Author

🤩

@daxartio
Copy link
Collaborator

daxartio commented Aug 2, 2023

Well... I wrote a simple code for this result. What do you think?

<!-- termynal: {"prompt_literal_start": ["$", ">>>", "PS >"], title: powershell, buttons: windows} -->

```
PS > python
>>> import json
```
image

@fresh2dev
Copy link
Author

I admire you working to make this just right. That looks very good! I find the default MacOS buttons to be too distracting when the focus should be on the code. The position of those buttons looks good, but for Windows/Linux, I would expect at least a X to close.

You don't have to implement my preferences, of course, but FWIW, here is the minimalist approach I took, and the pertinent CSS.

image

[data-termynal]:before {
    content: '- ⛶ X';
    color: var(--termynal-color-text-subtle);
    top: 5px;
    right: 7px;
    left: unset;
    width: unset;
    background: unset;
    -webkit-box-shadow: unset;
    box-shadow: unset;
}

I appreciate your interest and effort in making these enhancements! 🤜🤛

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

No branches or pull requests

2 participants