onflow / developer-portal

Source code for developers.flow.com
Apache License 2.0
8 stars 7 forks source link

Cadence Syntax Highlighting #681

Closed LaurenIke closed 1 year ago

LaurenIke commented 2 years ago

The old documentation site had support for highlighting Cadence code, both for Markdown code blocks and inline-code.

The new developer portal does not properly highlight code blocks, and does not highlight inline-code anymore.

For example, consider https://developers.flow.com/cadence/language/accounts#path-functions:

The old documentation page had support for both using this plugin, developed by @turbolent: https://github.com/onflow/flow/tree/v0.3.2/docs/plugins/gatsby-remark-vscode-flow

Previously, a PR proposed removing the inline-code prefixes, https://github.com/onflow/cadence/pull/1896, but this would be a worse experience then we had previously.

nvdtf commented 1 year ago

I'm not sure if we can change our syntax highlighter but if we use https://github.com/wooorm/starry-night cadence will be supported (https://github.com/wooorm/starry-night/blob/main/lang/source.cadence.js)

turbolent commented 1 year ago

We just need to port the highlighter over to the new one. It uses the same grammar as Starry Night, the TextMate grammar from the VS Code plugin.

turbolent commented 1 year ago

@schpet Do you know if there is a way to hook in a markdown AST plugin into the new developer portal?