Skip to content

Commit

Permalink
doc: Adding annotations support on highlight.js (FuelLabs#4186)
Browse files Browse the repository at this point in the history
## Description

resolves FuelLabs#2740
closes FuelLabs#4157

> In order to give a better highlighting I picked the "meta" scope as
seen in [highlight.js
docs](https://highlightjs.readthedocs.io/en/latest/css-classes-reference.html)
> 
> The ["Mode"
](https://highlightjs.readthedocs.io/en/latest/language-guide.html) I've
added provides the html class: _hljs-meta_ however, the result is a
white color for annotation (like plain text) and not a blue color as
requested in the issue.
> 
> The solution I've found for this is to add an additional css file to
specify custom behavior for the desired class. I haven't added this file
because I think it's out of scope.


## Checklist

- [✅ ] I have linked to any relevant issues.
- [ ?] I have commented my code, particularly in hard-to-understand
areas.
- [ ?] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ?] I have added tests that prove my fix is effective or that my
feature works.
- [✅] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [✅ ] I have done my best to ensure that my PR adheres to [the Fuel
Labs Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [ ?] I have requested a review from the relevant team or maintainers.

Co-authored-by: Mohammad Fawaz <[email protected]>
  • Loading branch information
cold-briu and mohammadfawaz authored Mar 10, 2023
1 parent 3d5698e commit 6338236
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
8 changes: 4 additions & 4 deletions docs/book/theme/highlight.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
Highlight.js v11.3.1 (git: 2a972d8658)
(c) 2006-2022 Ivan Sagalaev and other contributors
(c) 2006-2023 Ivan Sagalaev and other contributors
License: BSD-3-Clause
*/
var hljs=function(){"use strict";var e={exports:{}};function t(e){
Expand Down Expand Up @@ -310,9 +310,9 @@ illegal:"</",contains:[e.C_LINE_COMMENT_MODE,e.COMMENT("/\\*","\\*/",{
contains:["self"]}),e.inherit(e.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{
className:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{
begin:/b?'\\?(x\w{2}|u\w{4}|U\w{8}|.)'/}]},{className:"symbol",
begin:/'[a-zA-Z_][a-zA-Z0-9_]*/},{className:"number",variants:[{
begin:"\\b0b([01_]+)"+n},{begin:"\\b0o([0-7_]+)"+n},{
begin:"\\b0x([A-Fa-f0-9_]+)"+n},{
begin:/'[a-zA-Z_][a-zA-Z0-9_]*/},{scope:"meta",match:/#\[.*\]/},{
className:"number",variants:[{begin:"\\b0b([01_]+)"+n},{begin:"\\b0o([0-7_]+)"+n
},{begin:"\\b0x([A-Fa-f0-9_]+)"+n},{
begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+n}],relevance:0},{
begin:[/fn/,/\s+/,e.UNDERSCORE_IDENT_RE],className:{1:"keyword",
3:"title.function"}},{
Expand Down
8 changes: 4 additions & 4 deletions docs/reference/theme/highlight.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
Highlight.js v11.3.1 (git: 2a972d8658)
(c) 2006-2022 Ivan Sagalaev and other contributors
(c) 2006-2023 Ivan Sagalaev and other contributors
License: BSD-3-Clause
*/
var hljs=function(){"use strict";var e={exports:{}};function t(e){
Expand Down Expand Up @@ -310,9 +310,9 @@ illegal:"</",contains:[e.C_LINE_COMMENT_MODE,e.COMMENT("/\\*","\\*/",{
contains:["self"]}),e.inherit(e.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{
className:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{
begin:/b?'\\?(x\w{2}|u\w{4}|U\w{8}|.)'/}]},{className:"symbol",
begin:/'[a-zA-Z_][a-zA-Z0-9_]*/},{className:"number",variants:[{
begin:"\\b0b([01_]+)"+n},{begin:"\\b0o([0-7_]+)"+n},{
begin:"\\b0x([A-Fa-f0-9_]+)"+n},{
begin:/'[a-zA-Z_][a-zA-Z0-9_]*/},{scope:"meta",match:/#\[.*\]/},{
className:"number",variants:[{begin:"\\b0b([01_]+)"+n},{begin:"\\b0o([0-7_]+)"+n
},{begin:"\\b0x([A-Fa-f0-9_]+)"+n},{
begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+n}],relevance:0},{
begin:[/fn/,/\s+/,e.UNDERSCORE_IDENT_RE],className:{1:"keyword",
3:"title.function"}},{
Expand Down
8 changes: 4 additions & 4 deletions forc-plugins/forc-doc/src/assets/highlight.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
Highlight.js v11.3.1 (git: 2a972d8658)
(c) 2006-2022 Ivan Sagalaev and other contributors
(c) 2006-2023 Ivan Sagalaev and other contributors
License: BSD-3-Clause
*/
var hljs=function(){"use strict";var e={exports:{}};function t(e){
Expand Down Expand Up @@ -310,9 +310,9 @@ illegal:"</",contains:[e.C_LINE_COMMENT_MODE,e.COMMENT("/\\*","\\*/",{
contains:["self"]}),e.inherit(e.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{
className:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{
begin:/b?'\\?(x\w{2}|u\w{4}|U\w{8}|.)'/}]},{className:"symbol",
begin:/'[a-zA-Z_][a-zA-Z0-9_]*/},{className:"number",variants:[{
begin:"\\b0b([01_]+)"+n},{begin:"\\b0o([0-7_]+)"+n},{
begin:"\\b0x([A-Fa-f0-9_]+)"+n},{
begin:/'[a-zA-Z_][a-zA-Z0-9_]*/},{scope:"meta",match:/#\[.*\]/},{
className:"number",variants:[{begin:"\\b0b([01_]+)"+n},{begin:"\\b0o([0-7_]+)"+n
},{begin:"\\b0x([A-Fa-f0-9_]+)"+n},{
begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+n}],relevance:0},{
begin:[/fn/,/\s+/,e.UNDERSCORE_IDENT_RE],className:{1:"keyword",
3:"title.function"}},{
Expand Down
4 changes: 4 additions & 0 deletions scripts/highlightjs/sway.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ export default function(hljs) {
}
]
},
{
scope: 'meta',
match: /#\[.*\]/,
},
{
className: 'symbol',
begin: /'[a-zA-Z_][a-zA-Z0-9_]*/
Expand Down

0 comments on commit 6338236

Please sign in to comment.