Skip to content

Commit

Permalink
feat: add copy code button
Browse files Browse the repository at this point in the history
  • Loading branch information
jouwdan committed Jan 18, 2023
1 parent a3bd114 commit 5d49076
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 35 deletions.
18 changes: 18 additions & 0 deletions apps/course/static/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,21 @@ code.hljs {
font-weight: 700;
}
}

.copy-code {
padding: 3px 5px 3px 5px;
color: #ffffff;
margin-top: 4px;
background: #37919b;
border-radius: 5px;
float:right;
}

.copy-code:hover {
background: #73b2b9;
}

.prose :where(pre):not(:where([class~="not-prose"] *)) {
margin-top: 0px !important;
margin-bottom: 0px !important;
}
78 changes: 50 additions & 28 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 7 additions & 6 deletions packages/tutors-reader-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,22 @@
"url": "https://github.com/tutors-sdk/tutors-kit.git"
},
"devDependencies": {
"@iconify/svelte": "^3.0.1",
"@types/remove-markdown": "^0.3.1",
"@types/showdown": "2.0.0",
"@iconify/svelte": "^3.0.1",
"auth0-js": "^9.20.0",
"crypto-es": "^1.2.7",
"eslint-config-custom": "*",
"firebase": "^9.15.0",
"path-browserify": "^1.0.1",
"remove-markdown": "^0.5.0",
"showdown": "2.1.0",
"svelte-spa-router": "^3.3.0",
"showdown-copy-code": "^1.0.2",
"showdown-custom-class": "^1.0.0",
"showdown-emoji": "^3.0.0",
"showdown-highlight": "3.1.0",
"showdown-katex": "^0.8.0",
"remove-markdown": "^0.5.0",
"firebase": "^9.15.0",
"path-browserify": "^1.0.1",
"eslint-config-custom": "*",
"svelte-spa-router": "^3.3.0",
"typescript": "^4.9.4"
}
}
4 changes: 3 additions & 1 deletion packages/tutors-reader-lib/src/utils/markdown-utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import showdown from "showdown";
import showdownHighlight from "showdown-highlight";
import { showdownCopyCode } from "showdown-copy-code";
//import showdownKatex from "showdown-katex";
import customClassExt from "showdown-custom-class";

Expand All @@ -9,7 +10,8 @@ const converter = new showdown.Converter({
openLinksInNewWindow: true,
extensions: [
showdownHighlight,
customClassExt
customClassExt,
showdownCopyCode
// showdownKatex({
// // maybe you want katex to throwOnError
// throwOnError: false,
Expand Down

0 comments on commit 5d49076

Please sign in to comment.