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

deps: Bump Docusaurus 3.3.2+Fix line highlighting #820

Merged
merged 4 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,11 @@ region name:
To define the region in the referenced file put `#region some-region-name` and
`#endregion some-region-name` as a comment line.

Highlighting specific lines also work:
Highlighting specific lines also work by passing the list of lines and/or line
ranges as a third parameter:

```markdown
![code go {4-6}](../../examples/somefile.go)
![code go {5-8,13,21}](../../examples/somefile.go)
```

### Backward compatibility
Expand Down
2 changes: 1 addition & 1 deletion docs/dapp/diagrams/opl-contract-flow.mmd.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion external/cli
Submodule cli updated 60 files
+1 −1 .github/workflows/ci-lint.yml
+1 −4 cmd/account/delegate.go
+1 −3 cmd/account/deposit.go
+2 −2 cmd/account/entity.go
+16 −6 cmd/account/transfer.go
+1 −3 cmd/account/withdraw.go
+12 −0 cmd/common/flags.go
+1 −1 cmd/common/prompts.go
+16 −0 cmd/common/selector.go
+13 −14 cmd/common/transaction.go
+1 −1 cmd/common/wallet.go
+354 −312 cmd/network/governance/show.go
+58 −1 cmd/network/show.go
+180 −19 cmd/network/status.go
+1 −0 cmd/paratime/add.go
+49 −22 cmd/wallet/remove.go
+40 −2 config/config.go
+21 −3 config/default.go
+3 −2 docs/README.md
+25 −3 docs/account.md
+22 −0 docs/network.md
+12 −11 docs/transaction.md
+10 −4 docs/wallet.md
+2 −2 examples/account/config/cli.toml
+2 −2 examples/addressbook/config/cli.toml
+132 −0 examples/migration/config/cli.toml
+1 −0 examples/migration/network-chaincontext-and-rpcs.in
+3 −0 examples/migration/network-chaincontext-and-rpcs.out
+1 −0 examples/network-governance/list.out
+1 −0 examples/network-governance/show-votes.in.static
+73 −0 examples/network-governance/show-votes.out.static
+1 −1 examples/network-governance/show.in.static
+17 −34 examples/network-governance/show.out.static
+3 −3 examples/network-set-rpc/00-list.out
+1 −1 examples/network-set-rpc/01-set-rpc.in
+3 −3 examples/network-set-rpc/02-list.out
+3 −3 examples/network-set-rpc/config/cli.toml
+1 −0 examples/network-show/committees.in.static
+99 −0 examples/network-show/committees.out.static
+3 −3 examples/network/00-list.out
+2 −2 examples/network/02-list.out
+2 −2 examples/network/04-list.out
+2 −2 examples/network/06-list.out
+1 −1 examples/network/add-tcpip.in.static
+3 −3 examples/network/config/cli.toml
+1 −0 examples/network/status-json.in.static
+663 −0 examples/network/status-json.out.static
+46 −602 examples/network/status.out.static
+1 −0 examples/paratime-remove/00-list.out
+1 −0 examples/paratime-remove/02-list.out
+2 −2 examples/paratime-remove/config/cli.toml
+1 −0 examples/paratime/00-list.out
+1 −0 examples/paratime/02-list.out
+1 −1 examples/transaction/sign.y.out
+2 −2 examples/wallet/config/cli.toml
+1 −0 examples/wallet/remove-y.in.static
+0 −0 examples/wallet/remove-y.out.static
+45 −47 go.mod
+149 −164 go.sum
+2 −2 wallet/file/file.go
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
"fmt-markdown": "markdownlint-cli2-fix 'docs/**/*.md' 'docs/**/*.mdx'"
},
"dependencies": {
"@docusaurus/core": "^3.2.1",
"@docusaurus/plugin-client-redirects": "^3.2.1",
"@docusaurus/preset-classic": "^3.2.1",
"@docusaurus/remark-plugin-npm2yarn": "^3.2.1",
"@docusaurus/core": "3.3.2",
"@docusaurus/plugin-client-redirects": "3.3.2",
"@docusaurus/preset-classic": "3.3.2",
"@docusaurus/remark-plugin-npm2yarn": "3.3.2",
"@easyops-cn/docusaurus-search-local": "^0.40.1",
"@mdx-js/react": "^3.0.0",
"@mermaid-js/mermaid-cli": "^10.6.1",
Expand Down
38 changes: 2 additions & 36 deletions src/remark/code-block-snippets.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,53 +85,19 @@ test('region', () => {
expect(node.value.split("\n").length).toBe(4);
});

test('highlight-line-numbers', () => {
let node = {
type: 'paragraph',
children: [{
type: 'image',
alt: 'code {4-6}',
url: 'src/remark/code-block-snippets.test.ts',
}],
};

visitor(node);

expect(node.type).toBe('code');
expect(node.meta).toBe('{4-6}');
});

test('highlight-line-numbers-title', () => {
let node = {
type: 'paragraph',
children: [{
type: 'image',
alt: 'code {4-6}',
url: 'src/remark/code-block-snippets.test.ts',
title: 'Some title',
}],
};

visitor(node);

expect(node.type).toBe('code');
expect(node.meta).toBe('{4-6} title="Some title"');
});

test('highlight-line-numbers-lang', () => {
let node = {
type: 'paragraph',
children: [{
type: 'image',
alt: 'code text {4-6}',
alt: 'code text 4-6', // {4-6} curly brackets are automatically stripped.
url: 'src/remark/code-block-snippets.test.ts',
}],
};

visitor(node);

expect(node.type).toBe('code');
expect(node.lang).toBe('text');
expect(node.meta).toBe('{4-6}');
});

Expand All @@ -140,7 +106,7 @@ test('highlight-line-numbers-lang-title', () => {
type: 'paragraph',
children: [{
type: 'image',
alt: 'code text {4-6}',
alt: 'code text 4-6', // {4-6} curly brackets are automatically stripped.
url: 'src/remark/code-block-snippets.test.ts',
title: 'Some title',
}],
Expand Down
6 changes: 3 additions & 3 deletions src/remark/code-block-snippets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ export function visitor(untypedNode: mdast.Node): asserts untypedNode is mdast.C
node.meta = `title="${imgNode.title}"`;
}

// Highlight line numbers, if {some-range,and,some,more,lines} syntax used.
const lineNumber = imgNode.alt.match(/(\{.*\})/g);
// Highlight line numbers, if the third argument is passed. The curly brackets are already stripped. e.g. some-range,and,some,more,lines
const lineNumber = imgNode.alt.split(" ")[2];
if (lineNumber) {
node.meta = lineNumber[0] + (node.meta?" "+node.meta:"");
node.meta = `{${lineNumber}}${node.meta?" "+node.meta:""}`;
}

// Source filename can have fragment symbol # followed by the line number(s) or region name.
Expand Down
Loading
Loading