{"id":13667455,"url":"https://github.com/alex-ross/HighlightJSPublishPlugin","last_synced_at":"2025-04-26T15:32:53.691Z","repository":{"id":39589320,"uuid":"235440771","full_name":"alex-ross/HighlightJSPublishPlugin","owner":"alex-ross","description":"Highlight JS Publish Plugin","archived":false,"fork":false,"pushed_at":"2022-07-26T19:51:23.000Z","size":254,"stargazers_count":11,"open_issues_count":3,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-25T16:04:17.649Z","etag":null,"topics":["highlight-js","highlightjs","plugin","publish","publish-plugin","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alex-ross.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-21T21:01:41.000Z","updated_at":"2022-10-08T15:55:38.000Z","dependencies_parsed_at":"2022-08-01T08:09:33.124Z","dependency_job_id":null,"html_url":"https://github.com/alex-ross/HighlightJSPublishPlugin","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alex-ross%2FHighlightJSPublishPlugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alex-ross%2FHighlightJSPublishPlugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alex-ross%2FHighlightJSPublishPlugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alex-ross%2FHighlightJSPublishPlugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alex-ross","download_url":"https://codeload.github.com/alex-ross/HighlightJSPublishPlugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251008906,"owners_count":21522196,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["highlight-js","highlightjs","plugin","publish","publish-plugin","swift"],"created_at":"2024-08-02T07:00:37.386Z","updated_at":"2025-04-26T15:32:48.681Z","avatar_url":"https://github.com/alex-ross.png","language":"Swift","funding_links":[],"categories":["Plugins"],"sub_categories":[],"readme":"# HighlightJSPublishPlugin\n\nA [highlight.js](https://highlightjs.org) plugin for [Publish](https://github.com/johnsundell/publish) to highlight code.\n\nhighlight.js is a syntax highlighting tool made in javascript that supports many languages.\n\n## Requirements\n\n- Swift 5\n- [JavaScriptCore](https://developer.apple.com/documentation/javascriptcore) that comes with Swift on macOS, iOS and tvOS (so this may not work on linux)\n- highlight.js color scheme in your .css file\n\n## Installation\n\nAdd HighlightJSPublishPlugin to your package.\n\n```swift\nlet package = Package(\n    ...\n    dependencies: [\n        .package(url: \"https://github.com/alex-ross/highlightjspublishplugin\", from: \"1.0.0\")\n    ],\n    targets: [\n        .target(\n            ...\n            dependencies: [\n                ...\n                \"HighlightJSPublishPlugin\"\n            ]\n        )\n    ]\n    ...\n)\n```\n\n## Usage\n\n1. Add `.highlightJS()` to your pipeline.\n```swift\nimport HighlightJSPublishPlugin\n...\ntry MyWebsite().publish(using: [\n    .installPlugin(.highlightJS()),\n    ...\n    .addMarkdownFiles(),\n    ...\n])\n```\n2. Add a highlight.js color scheme in your css file. You can find many on internet and in their repository [here](https://github.com/highlightjs/highlight.js/tree/master/src/styles). I also include an example in the bottom of this readme that you could use if you would like to get different color scheme if the user is using dark mode or not.\n3. Write highlighted codes!\n\nIn your markdown file, specify language after \\`\\`\\` to get correct highlight.\n````markdown\n```swift\nlet str = \"This is Swift code.\"\nprint(str)\n```\n````\n\nSpecify code as `python`\n````markdown\n```python\nstr = \"This is also Swift code.\"\nprint(str)\n```\n````\n\nIf no language is specified, no syntax will be used as default.\n````markdown\n```\nlet str = \"This is also Swift code.\"\nprint(str)\n```\n````\n\n## Note\n\nThis plugin will highlight all code block but not inline codes.\n\nEnjoy your highlighted sites!\n\n## Acknowledgement\n\nThanks to John Sundell (@johnsundell) for creating [Publish](https://github.com/johnsundell/publish) and SplashPublishPlugin.\n\nThanks to Zhijin Chen (@Ze0nC) for creating the [SwiftPygmentsPublishPlugin](https://github.com/Ze0nC/SwiftPygmentsPublishPlugin) that has been a inspiration for this plugin.\n\n## License\n\nMIT License\n\n## CSS example\n\n```css\n/**\n * MARK: Highlight JS\n */\n\n/*\n\n Atom One Light by Daniel Gamage\n Original One Light Syntax theme from https://github.com/atom/one-light-syntax\n\n base:    #fafafa\n mono-1:  #383a42\n mono-2:  #686b77\n mono-3:  #a0a1a7\n hue-1:   #0184bb\n hue-2:   #4078f2\n hue-3:   #a626a4\n hue-4:   #50a14f\n hue-5:   #e45649\n hue-5-2: #c91243\n hue-6:   #986801\n hue-6-2: #c18401\n\n */\n\n.hljs {\n    display: block;\n    overflow-x: auto;\n    padding: 0.5em;\n    color: #383a42;\n    background: #fafafa;\n}\n\n.hljs-comment,\n.hljs-quote {\n    color: #a0a1a7;\n    font-style: italic;\n}\n\n.hljs-doctag,\n.hljs-keyword,\n.hljs-formula {\n    color: #a626a4;\n}\n\n.hljs-section,\n.hljs-name,\n.hljs-selector-tag,\n.hljs-deletion,\n.hljs-subst {\n    color: #e45649;\n}\n\n.hljs-literal {\n    color: #0184bb;\n}\n\n.hljs-string,\n.hljs-regexp,\n.hljs-addition,\n.hljs-attribute,\n.hljs-meta-string {\n    color: #50a14f;\n}\n\n.hljs-built_in,\n.hljs-class .hljs-title {\n    color: #c18401;\n}\n\n.hljs-attr,\n.hljs-variable,\n.hljs-template-variable,\n.hljs-type,\n.hljs-selector-class,\n.hljs-selector-attr,\n.hljs-selector-pseudo,\n.hljs-number {\n    color: #986801;\n}\n\n.hljs-symbol,\n.hljs-bullet,\n.hljs-link,\n.hljs-meta,\n.hljs-selector-id,\n.hljs-title {\n    color: #4078f2;\n}\n\n.hljs-emphasis {\n    font-style: italic;\n}\n\n.hljs-strong {\n    font-weight: bold;\n}\n\n.hljs-link {\n    text-decoration: underline;\n}\n\n@media (prefers-color-scheme: dark) {\n    /*\n\n     Atom One Dark by Daniel Gamage\n     Original One Dark Syntax theme from https://github.com/atom/one-dark-syntax\n\n     base:    #282c34\n     mono-1:  #abb2bf\n     mono-2:  #818896\n     mono-3:  #5c6370\n     hue-1:   #56b6c2\n     hue-2:   #61aeee\n     hue-3:   #c678dd\n     hue-4:   #98c379\n     hue-5:   #e06c75\n     hue-5-2: #be5046\n     hue-6:   #d19a66\n     hue-6-2: #e6c07b\n\n     */\n\n    .hljs {\n        display: block;\n        overflow-x: auto;\n        padding: 0.5em;\n        color: #abb2bf;\n        background: #282c34;\n    }\n\n    .hljs-comment,\n    .hljs-quote {\n        color: #5c6370;\n        font-style: italic;\n    }\n\n    .hljs-doctag,\n    .hljs-keyword,\n    .hljs-formula {\n        color: #c678dd;\n    }\n\n    .hljs-section,\n    .hljs-name,\n    .hljs-selector-tag,\n    .hljs-deletion,\n    .hljs-subst {\n        color: #e06c75;\n    }\n\n    .hljs-literal {\n        color: #56b6c2;\n    }\n\n    .hljs-string,\n    .hljs-regexp,\n    .hljs-addition,\n    .hljs-attribute,\n    .hljs-meta-string {\n        color: #98c379;\n    }\n\n    .hljs-built_in,\n    .hljs-class .hljs-title {\n        color: #e6c07b;\n    }\n\n    .hljs-attr,\n    .hljs-variable,\n    .hljs-template-variable,\n    .hljs-type,\n    .hljs-selector-class,\n    .hljs-selector-attr,\n    .hljs-selector-pseudo,\n    .hljs-number {\n        color: #d19a66;\n    }\n\n    .hljs-symbol,\n    .hljs-bullet,\n    .hljs-link,\n    .hljs-meta,\n    .hljs-selector-id,\n    .hljs-title {\n        color: #61aeee;\n    }\n\n    .hljs-emphasis {\n        font-style: italic;\n    }\n\n    .hljs-strong {\n        font-weight: bold;\n    }\n\n    .hljs-link {\n        text-decoration: underline;\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falex-ross%2FHighlightJSPublishPlugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falex-ross%2FHighlightJSPublishPlugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falex-ross%2FHighlightJSPublishPlugin/lists"}