From 07ed3c86ef45145fb1b5869c686e1ec31fe3d5fb Mon Sep 17 00:00:00 2001 From: Wirusik Date: Thu, 6 Oct 2022 19:21:47 +0200 Subject: [PATCH] modify and add CodeShell for rest How To section --- src/components/elements/CodeShell.js | 14 +++- src/components/sections/HowTo.js | 106 ++++++--------------------- 2 files changed, 33 insertions(+), 87 deletions(-) diff --git a/src/components/elements/CodeShell.js b/src/components/elements/CodeShell.js index d1b2b48..9172ac0 100644 --- a/src/components/elements/CodeShell.js +++ b/src/components/elements/CodeShell.js @@ -22,12 +22,22 @@ const CodeShellStyle = styled(FlexColumn)` `; const CodeShell = (props) => { + const formatCommand = (command) => { + if (command[0] === '\t') { + return <>    {formatCommand(command.slice(1))}; + /* eslint-disable */ + } else if (command[0] === '\s') { + return <> {formatCommand(command.slice(1))}; + } return command; + }; + const renderCommands = () => { return ( props.commands.map((command, index) => { return ( - - {command} + + {formatCommand(command)} ); }) diff --git a/src/components/sections/HowTo.js b/src/components/sections/HowTo.js index 5711467..5d644cf 100644 --- a/src/components/sections/HowTo.js +++ b/src/components/sections/HowTo.js @@ -67,32 +67,17 @@ const HowTo = () => { source codes along with out.tsv files. - {/**/} - {/* */} - {/* ~$ cd challenging-america-geo-prediction*/} - {/* */} - {/* */} - {/* ~$ git checkout -b my-brilliant-branch # switch to some other branch*/} - {/* */} - {/* */} - {/* ~$ git add foo.py build.sh # add your source codes*/} - {/* */} - {/* */} - {/* ~$ git add gonito.yaml # it's a good practice to add metadata file, see*/} - {/* below*/} - {/* */} - {/**/} - {/**/} - {/* */} - {/* ~$ git add dev-0/out.tsv test-A/out.tsv # add your output files*/} - {/* */} - {/* */} - {/* ~$ git commit -m 'my brilliant solution'*/} - {/* */} - {/* */} - {/* ~$ git push origin my-brilliant-branch*/} - {/* */} - {/**/} + +

@@ -226,65 +211,16 @@ const HowTo = () => { that you can also add links to external resources using the `links` section): - {/**/} - {/* */} - {/* description: This my brilliant solution*/} - {/* */} - {/* */} - {/* tags:*/} - {/* */} - {/* */} - {/* - neural-network*/} - {/* */} - {/* */} - {/* - left-to-right*/} - {/* */} - {/* */} - {/* params:*/} - {/* */} - {/* */} - {/* epochs: 10*/} - {/* */} - {/* */} - {/* learning-rate: 0.01*/} - {/* */} - {/* */} - {/* unwanted-params:*/} - {/* */} - {/* */} - {/* - model-file*/} - {/* */} - {/* */} - {/* - vocab-file*/} - {/* */} - {/* */} - {/* param-files:*/} - {/* */} - {/* */} - {/* - “*.yaml”*/} - {/* */} - {/* */} - {/* - config/*.yaml*/} - {/* */} - {/* */} - {/* links:*/} - {/* */} - {/* */} - {/* - title: "Some external link"*/} - {/* */} - {/* */} - {/*   url: "https://example.com/foo-bar-baz-123"*/} - {/* */} - {/* */} - {/* - title: "Yet another link"*/} - {/* */} - {/* */} - {/*   url: "https://example.org/xyz"*/} - {/* */} - {/* */} - {/* - url: "https://example.net/bare-link-without-text"*/} - {/* */} - {/**/} + It might seem a little bit complicated, but you could simply use the method which is the most convenient for you.