Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
www
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PLN
www
Commits
fb605f2e
Commit
fb605f2e
authored
4 years ago
by
PLN (Algolia)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: Hydras code highlighted
parent
5627b9eb
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
127 additions
and
7 deletions
+127
-7
.nvmrc
next/.nvmrc
+1
-0
package.json
next/package.json
+1
-0
[id].js
next/pages/hydra/[id].js
+11
-7
main.css
next/styles/main.css
+1
-0
yarn.lock
next/yarn.lock
+113
-0
No files found.
next/.nvmrc
0 → 100644
View file @
fb605f2e
12
This diff is collapsed.
Click to expand it.
next/package.json
View file @
fb605f2e
...
...
@@ -20,6 +20,7 @@
"react"
:
"^17.0.2"
,
"react-dom"
:
"^17.0.2"
,
"react-player"
:
"^2.9.0"
,
"react-syntax-highlighter"
:
"^15.4.3"
,
"remark"
:
"^13.0.0"
,
"remark-html"
:
"^13.0.1"
},
...
...
This diff is collapsed.
Click to expand it.
next/pages/hydra/[id].js
View file @
fb605f2e
import
SyntaxHighlighter
from
"react-syntax-highlighter"
;
import
Head
from
"next/head"
;
import
Layout
from
"../../components/layout"
;
import
HydraSynth
from
"../../components/hydra"
;
import
Date
from
"../../components/date"
;
const
https
=
require
(
'https'
)
const
https
=
require
(
"https"
);
import
utilStyles
from
"../../styles/utils.module.css"
;
import
{
getAllHydraIds
,
getHydraData
}
from
"../../lib/hydras"
;
...
...
@@ -12,7 +13,7 @@ export async function getStaticProps({ params }) {
const
response
=
await
fetch
(
hydraData
.
source
);
const
source
=
await
response
.
text
();
const
sourceCode
=
source
.
replace
(
/
(?:\r\n
|
\r
|
\n)
/g
,
'<br>'
);
const
sourceCode
=
source
.
replace
(
/
(?:\r\n
|
\r
|
\n)
/g
,
"<br>"
);
console
.
log
(
sourceCode
);
hydraData
.
source
=
source
;
...
...
@@ -20,7 +21,7 @@ export async function getStaticProps({ params }) {
return
{
props
:
{
hydraData
,
sourceCode
sourceCode
,
},
};
}
...
...
@@ -41,12 +42,15 @@ export default function Hydra({ hydraData, sourceCode }) {
<
/Head
>
<
article
>
<
h1
className
=
{
utilStyles
.
headingXl
}
>
{
hydraData
.
title
}
<
/h1
>
<
p
className
=
"code"
dangerouslySetInnerHTML
=
{{
__html
:
sourceCode
}}
/
>
<
/article
>
<
HydraSynth
<
SyntaxHighlighter
width
=
"64em"
language
=
"javascript"
wrapLongLines
=
{
true
}
>
{
hydraData
.
source
}
<
/SyntaxHighlighter
>
{
/*<HydraSynth
width={700}
height={475}
source
=
{
hydraData
.
source
}
/
>
source={hydraData.source}/>*/
}
<
/article
>
<
/Layout
>
);
}
This diff is collapsed.
Click to expand it.
next/styles/main.css
View file @
fb605f2e
...
...
@@ -68,6 +68,7 @@ h1 a, h2 a, h3 a, h4 a, h5 a {
text-decoration
:
underline
;
}
.player-wrapper
{
padding
:
12em
0
;
position
:
relative
;
...
...
This diff is collapsed.
Click to expand it.
next/yarn.lock
View file @
fb605f2e
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment