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 suger-high #46

Merged
merged 20 commits into from
Dec 4, 2023
Merged

support suger-high #46

merged 20 commits into from
Dec 4, 2023

Conversation

JSerZANP
Copy link
Owner

@JSerZANP JSerZANP commented Dec 3, 2023

#43

Copy link

vercel bot commented Dec 3, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
shaku-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 4, 2023 2:44pm

@@ -4,12 +4,13 @@ pre.shaku {
overflow-x: auto;
}

pre.shaku .line {
pre.shaku .line,
pre.shaku .sh__line {
Copy link
Owner Author

Choose a reason for hiding this comment

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

separate these 2 sets of CSS

--sh-string: #00a99a;
--sh-keyword: #f47067;
--sh-comment: #a19595;
--sh-jsxliterals: #6266d1;
Copy link
Owner Author

Choose a reason for hiding this comment

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

dark mode

@@ -48,7 +48,7 @@ function isShakuDirectiveHighlightInline(str: string): {
shift: number;
isHighlightInline: boolean;
} {
const significantLine = str.replace(/ /g, "");
const significantLine = str.replace(/\s/g, "");
Copy link
Owner Author

@JSerZANP JSerZANP Dec 3, 2023

Choose a reason for hiding this comment

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

  • add tests


### Patch Changes

- bump
Copy link
Owner Author

Choose a reason for hiding this comment

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

  • remove this

@@ -0,0 +1,52 @@
# shaku-code-annotate-shiki
Copy link
Owner Author

Choose a reason for hiding this comment

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

  • update this

@@ -0,0 +1,52 @@
# shaku-code-annotate-shiki

<ruby>釈<rp>(<rp><rt>Shaku</rt><rp>)<rp></ruby>- _elucidate, explain_
Copy link
Owner Author

Choose a reason for hiding this comment

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

  • also update shaku homepage

@@ -0,0 +1,34 @@
{
"name": "shaku-code-annotate-sugar-high",
"version": "0.1.4",
Copy link
Owner Author

@JSerZANP JSerZANP Dec 3, 2023

Choose a reason for hiding this comment

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

  • 0.0.1?

* 4. the first meaningful token has the comment body
* - find the first explanation that is not `punctuation.definition`.
*/
function parseComment(
Copy link
Owner Author

Choose a reason for hiding this comment

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

  • update

@@ -0,0 +1,26 @@
export const defaultCode = `
Copy link
Owner Author

Choose a reason for hiding this comment

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

  • test


return (
<button onClick={handleClick}>
{/* ^ */}
Copy link
Owner Author

Choose a reason for hiding this comment

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

  • add // xxx in jsx


// @ts-ignore
// this type is missing from sugar-high
const TokenTypes = sh.SugarHigh.TokenTypes;
Copy link
Owner Author

Choose a reason for hiding this comment

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

  • create an issue on sugar-high

type RawToken = [number, string];

export function highlight(code: string) {
const tokens = sh.tokenize(code);
Copy link
Owner Author

Choose a reason for hiding this comment

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

  • move the logic into codeToHTML?

);
contents.push(
// in sugar-high, we don't need md parsing
nextLine.line.config.content
Copy link
Owner Author

Choose a reason for hiding this comment

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

  • this needs to be escaped!

);
j += 1;
}
html += renderComponent({
Copy link
Owner Author

Choose a reason for hiding this comment

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

  • separate renderComponent() into two, one supports HTML and sanitize. one does escape.

@JSerZANP JSerZANP merged commit bf8fa2b into main Dec 4, 2023
3 checks passed
@JSerZANP JSerZANP deleted the sugar-high branch January 10, 2024 11:23
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.

1 participant