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

shiki-renderer-svg support #681

Closed
wants to merge 11 commits into from
Closed

shiki-renderer-svg support #681

wants to merge 11 commits into from

Conversation

hhk-png
Copy link

@hhk-png hhk-png commented May 19, 2024

Description

The shiki-renderer-svg project located at packages/shiki-renderer-svg. The api of it and build tool(rollup) are equal to previous version.

It could use as:

const str = `const show = console.log
//  注释注释
async function fact(n) {
  return n === 0 ? 1 : n * (await fact (n - 1))
}
fact(6).then(show)`

const { tokens } = await codeToTokens(str, {
  lang: 'javascript',
  theme: 'github-light',
})
const { renderToSVG } = await getSVGRenderer()
// svg string
const res = await renderToSVG(tokens)

But the render options are different.

// current options
interface RenderOptions {
  fontFamily?: string
  fontSize?: number
  lineHeightRatio?: number
  backgroundColor?: string
  borderRadius?: number
  selectionbgColor?: string
  selectionColor?: string
  cursor?: string
  opacity?: number
  remoteFontCSSURL?: string
}
// previous options
interface SVGRendererOptions {
  fontFamily: string | RemoteFontFamily
  remoteFontCSSURL?: string
  fontSize?: number
  lineHeightToFontSizeRatio?: number
  bg?: string
  bgCornerRadius?: number
  bgSideCharPadding?: number
  bgVerticalCharPadding?: number
  bgMinWidth?: number
  bgFillOpacity?: number
}

Is there anything else that should to be changed?

Linked Issues

#678

Additional context

Copy link

netlify bot commented May 19, 2024

Deploy Preview for shiki-matsu ready!

Name Link
🔨 Latest commit 7a8dcc9
🔍 Latest deploy log https://app.netlify.com/sites/shiki-matsu/deploys/664b43301ea50c0008a19ef7
😎 Deploy Preview https://deploy-preview-681--shiki-matsu.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented May 19, 2024

Deploy Preview for shiki-next ready!

Name Link
🔨 Latest commit 7a8dcc9
🔍 Latest deploy log https://app.netlify.com/sites/shiki-next/deploys/664b433094a26200080bda48
😎 Deploy Preview https://deploy-preview-681--shiki-next.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@hhk-png
Copy link
Author

hhk-png commented May 19, 2024

The progress failed due to the install of playwright.

@hhk-png hhk-png closed this May 26, 2024
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.

None yet

1 participant