Skip to content

Commit

Permalink
feat: Add possiblity to change start line number
Browse files Browse the repository at this point in the history
  • Loading branch information
jimbiscuit committed Nov 21, 2022
1 parent b26b2bb commit 8e079a0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/components/Block/DefaultView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const CodeView = (props) => {
<SyntaxHighlighter
language={data.language}
useInlineStyles={false}
startingLineNumber={data.lineNbr ? Number(data.lineNbr) : 1}
showLineNumbers={showLineNumbers}
wrapLongLines={wrapLongLines}
>
Expand Down
17 changes: 16 additions & 1 deletion src/components/Block/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ const messages = defineMessages({
id: 'Wrap Long Lines',
defaultMessage: 'Wrap Long Lines',
},
lineNbr: {
id: 'Starting Line Number',
defaultMessage: 'Starting Line Number',
},
});

export const codeSchema = (props) => {
Expand All @@ -45,7 +49,13 @@ export const codeSchema = (props) => {
{
id: 'default',
title: 'Default',
fields: ['language', 'style', 'showLineNumbers', 'wrapLongLines'],
fields: [
'language',
'style',
'showLineNumbers',
'wrapLongLines',
'lineNbr',
],
},
],

Expand All @@ -72,6 +82,11 @@ export const codeSchema = (props) => {
default: true,
type: 'boolean',
},
lineNbr: {
title: props.intl.formatMessage(messages.lineNbr),
type: 'integer',
default: 1,
},
},
required: ['language'],
};
Expand Down

0 comments on commit 8e079a0

Please sign in to comment.