Skip to content

Commit 92625c4

Browse files
clean up, and some css
1 parent cca9a5e commit 92625c4

File tree

5 files changed

+59
-8029
lines changed

5 files changed

+59
-8029
lines changed

mfr/extensions/md/README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
2+
## Markdown plus Mathjax readme
3+
4+
Most of the packages are in there to try to match what the OSF wiki is doing. The two exceptions being markdown-it-highlightjs.js and markdown-it-mathjax.js. The highlighter matches the functionality of what is on the osf however, and the markdown-it-mathjax.js increases functionality with mathjax.
5+
6+
to get all the libraries needed:
7+
8+
```
9+
10+
npm install @centerforopenscience/[email protected]
11+
npm install [email protected]
12+
npm install [email protected]
13+
npm install [email protected]
14+
npm install [email protected]
15+
```
16+
17+
To add a new library, you need to make sure its loadable in md.js somehow, either through exporting via `root.<name>` or some other means. Some of the markdown plugins added have custom code in them to load them into `root`.
18+
19+
Libraries should try to use the same version as the ones used on the OSF. The plugins do not matter as much, but `markdown-it` and `Mathjax` you should try to match exactly because styling can change between versions.
20+
21+
To add a new library that is not already set up to export to `root` can be a bit tricky, but the gist of it is, wrap the plugin in this code:
22+
23+
```
24+
;(function (root, factory) {
25+
if (typeof exports === 'object') {
26+
module.exports = factory()
27+
} else {
28+
root.<PLUGIN_NAME> = factory()
29+
}
30+
})(this, function () {
31+
32+
33+
return function(md){
34+
35+
.....
36+
}
37+
38+
})
39+
```
40+
41+
And then modify it to work in this context. See other plugins for examples.
42+
43+
Then, in md.js, you can add a plugin to the markdown renderer by adding a `.use(<window.<PLUGIN_NAME>)`

mfr/extensions/md/static/css/default.css

Lines changed: 6 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -30,51 +30,14 @@
3030
* @valid true
3131
*/
3232

33-
body {
34-
font-family: 'Open Sans', 'Helvetica Neue', sans-serif;
35-
padding:1em;
36-
margin:auto;
37-
background:#fefefe;
38-
}
39-
40-
.mfrViewer {
41-
padding: 10px;
42-
height: auto;
43-
}
4433

45-
hr {
46-
height: 0.2em;
47-
border: 0;
48-
color: #CCCCCC;
49-
background-color: #CCCCCC;
50-
}
5134

52-
p, blockquote, ul, ol, dl, li, table, pre {
53-
margin: 15px 0;
54-
}
5535

56-
code, pre {
57-
border-radius: 3px;
58-
background-color: #F8F8F8;
59-
color: inherit;
60-
}
61-
62-
63-
pre {
64-
border: 1px solid #CCCCCC;
65-
line-height: 1.25em;
66-
overflow: auto;
67-
padding: 6px 10px;
68-
}
69-
70-
pre > code {
71-
border: 0;
72-
margin: 0;
73-
padding: 0;
36+
.mfrViewer {
37+
font-family: 'Open Sans';
38+
padding:1em;
39+
background:#fefefe;
40+
height: auto;
41+
word-wrap: break-word;
7442
}
7543

76-
a, a:visited {
77-
color: #4183C4;
78-
background-color: inherit;
79-
text-decoration: none;
80-
}

0 commit comments

Comments
 (0)