Skip to content

feat: prism highlighting #33

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
wants to merge 27 commits into
base: main
Choose a base branch
from
Open

feat: prism highlighting #33

wants to merge 27 commits into from

Conversation

load1n9
Copy link
Member

@load1n9 load1n9 commented Dec 8, 2024

No description provided.

@load1n9 load1n9 requested a review from eliassjogreen December 8, 2024 19:13
Comment on lines 42 to 51
p>code {
background-color: light-dark(hsl(230, 1%, 98%), hsl(220, 13%, 18%));
outline: 0.15em solid light-dark(hsl(230, 1%, 98%), hsl(220, 13%, 18%));
}

pre:has(code) {
outline: 1rem solid var(--neutral-100);
background-color: var(--neutral-100);
outline: 1rem solid light-dark(hsl(230, 1%, 98%), hsl(220, 13%, 18%));
background-color: light-dark(hsl(230, 1%, 98%), hsl(220, 13%, 18%));
overflow: auto;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: What are these colors? Let's try to use the same bg colors as before if it still looks good. Otherwise at least make them variables.

background-color: var(--neutral-400);
-webkit-border-radius: 3px;
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: Missing newline

Comment on lines 4 to 10
>*:first-child {
margin-top: 0 !important;
}

> *:last-child {
>*:last-child {
margin-bottom: 0 !important;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: Revert formatting

Comment on lines +2 to +3
* One Dark theme & One Light theme for prism.js stolen and meddled with for this site
* Based on Atom's One Dark theme: https://github.com/atom/atom/tree/master/packages/one-dark-syntax
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: Add proper attribution or simply import the CSS directly from there.

public/prism.css Outdated
Comment on lines 245 to 260
/* Styling the buttons */
div.code-toolbar>.toolbar.toolbar>.toolbar-item>button,
div.code-toolbar>.toolbar.toolbar>.toolbar-item>a,
div.code-toolbar>.toolbar.toolbar>.toolbar-item>span {
background: light-dark(hsl(230, 1%, 90%), hsl(220, 13%, 26%));
color: light-dark(hsl(230, 6%, 44%), hsl(220, 9%, 55%));
padding: 0.1em 0.4em;
border-radius: 0.3em;
}

div.code-toolbar>.toolbar.toolbar>.toolbar-item>button:hover,
div.code-toolbar>.toolbar.toolbar>.toolbar-item>button:focus,
div.code-toolbar>.toolbar.toolbar>.toolbar-item>a:hover,
div.code-toolbar>.toolbar.toolbar>.toolbar-item>a:focus,
div.code-toolbar>.toolbar.toolbar>.toolbar-item>span:hover,
div.code-toolbar>.toolbar.toolbar>.toolbar-item>span:focus {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Looks an awful lot like a place where you could just use CSS nesting.

Comment on lines +368 to +369
/* Previewers plugin overrides */
/* Based on https://github.com/atom-community/atom-ide-datatip/blob/master/styles/atom-ide-datatips.less and https://github.com/atom/atom/blob/master/packages/one-dark-ui */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: Comment formatting and proper attribution.

langPrefix: "language-",
highlight(code, lang, _info) {
lang = languageAliases[lang] ?? lang;
const language = Prism.languages[lang] ?? Prism.languages.autoit;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Isn't autoit the hotkey language? You should default to no highlighting.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isnt our default language the autohotkey language?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nah wait wrong language its this one https://www.autoitscript.com/site/autoit/

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 this pull request may close these issues.

2 participants