Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Doc Enhancement] Introduce MarkdownElement #2224 #2226

Closed
wants to merge 1 commit into from

Conversation

frankf-cgn
Copy link

First working draft to implement #2224. Result can be seen on <ListsPage>.

In order to test, cd /docs, run npm install and npm run start. Visit http://localhost:3000/#/components/lists and scroll down to "Headline 1"

@shaurya947
Copy link
Contributor

I think this is a slightly better system than what we have today. Obviously, it is easier to write a docs page as a separate markdown file vs. using <p>, <h1> and <Codeblock> elements inside the source code. Moreover, using this approach would be more robust when we think of a multi-lingual docs site: #1673

@@ -15,6 +16,8 @@ const EditorInsertChart = require('svg-icons/editor/insert-chart');
const FileFolder = require('svg-icons/file/folder');
const MoreVertIcon = require('svg-icons/navigation/more-vert');
import { SelectableContainerEnhance } from 'material-ui/hoc/selectable-enhance';
require('github-markdown-css/github-markdown.css');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this should be move to markdown-element.jsx

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

your right, there it belongs!

@frankf-cgn
Copy link
Author

@oliviertassinari Thanks for your feedback!
All the stuff in docs/src/app/components/pages/components/lists.jsx was just there to illustrate the usage, I'm going to remove it.
I think I have to write some doc on how to use the <MarkdownElement>, but for now, I don't no where to put it.
Another open point is the css/style used within the Element. It's github-style and not very "material-design". Some adjustments seem to be appropriate. I'll work on this within the next days.

@oliviertassinari oliviertassinari added PR: needs revision The pull request can't be merged. More details is available on the code review or fails in the CI and removed Review: review-needed labels Nov 24, 2015
@shaurya947
Copy link
Contributor

@frankf-cgn I can see people using this component in their applications. So perhaps it makes sense to document it as a new component on its own page? @oliviertassinari what say?

@frankf-cgn
Copy link
Author

@shaurya947 Strictly taken, this is not a ui-component in "material-design". It's more like <CodeBlock>, <ComponentDoc> or <ComponentInfo>, so I'm not sure if this is a good fit.

@frankf-cgn frankf-cgn force-pushed the issue/2224 branch 3 times, most recently from f29aaf2 to f368cae Compare November 25, 2015 08:36
@shaurya947
Copy link
Contributor

I'm not sure.. Perhaps you are right, but this could be pretty useful for people making text-heavy web apps.

@oliviertassinari what do you think about making this a documented component with its own page like other components?

@frankf-cgn looking forward to the style changes!

EDIT: just spoke to @hai-cea and seems like it's not adherent to the Material Design spec to treat this like a regular MUI component.

@oliviertassinari
Copy link
Member

just spoke to @hai-cea and seems like it's not adherent to the Material Design spec to treat this like a regular MUI component.

I agree, let's keep this component for our doc.

@frankf-cgn frankf-cgn force-pushed the issue/2224 branch 2 times, most recently from 68ebca1 to 0e1ca0e Compare November 30, 2015 16:30
@frankf-cgn
Copy link
Author

@shaurya947 @oliviertassinari After pulling my hair over the lint-rules i finally managed to get this linted.

I have done the following stuff:

  • reorganize the paths for the markdown files
  • removed the package github-markdown
  • added a mui-github-markdown.css based on github-markdown.css with adjusted fonts settings and heading-styles
  • reworked parts ot the <ListPage> as a showcase on the usage of <MarkdownElement>

Just out of curiosity I played around with various possibilities on how to format the documentation of props in markdown. May ask for some feedback of you both on that?

@oliviertassinari
Copy link
Member

After pulling my hair over the lint-rules

Sorry, but this made me laught. I have enforced more rules lately 😬. I aim to follow at least eslint:recommended and may be https://github.com/rackt/eslint-config-rackt.

May ask for some feedback of you both on that

I will have a look 👍

const {text} = this.props;
const html = marked(text || '');

/* eslint-disable */
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To allow html-tags within markdown (e.g. for definition lists) dangerouslySetInnerHTML is needed which is prevented in .eslintL74 no-danger.
I think this is a non-issue here, because we truts the PR of the developer anyway.

@oliviertassinari oliviertassinari added Review: review-needed and removed PR: needs revision The pull request can't be merged. More details is available on the code review or fails in the CI labels Dec 1, 2015
@@ -15,8 +15,10 @@
},
"dependencies": {
"codemirror": "^5.5.0",
"hightlight.js": "^8.9.1",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'hightlight.js' is not in the npm registry.

@frankf-cgn
Copy link
Author

@oliviertassinari The ".js" is correct. but I have had a typo in "hightlight.js", that is now fixed and the style-loader is added, too.

@oliviertassinari
Copy link
Member

I have this following issue with webpack when running npm start on the doc folder.

ERROR in ./~/highlight.js/lib/languages/autoit.js
Module parse failed: /Users/oliviertassinari/material-ui/docs/node_modules/highlight.js/lib/languages/autoit.js Maximum call stack size exceeded
You may need an appropriate loader to handle this file type.

@frankf-cgn
Copy link
Author

@oliviertassinari I have no idea, why these npm-modules are installed globally in my environment - have to check this. Sorry for the noise it generates.
Despite I cannot reproduce the error you get with highlight.js/autoit.js I have found several hints how to mitigate this if it occures. I have modified the webpack-config accordingly. Can you check it out if it works for you now?

@oliviertassinari
Copy link
Member

@frankf-cgn With npm@3 and node@5, it's working 👍.

@oliviertassinari
Copy link
Member

@frankf-cgn I'm gonna add your MarkdownElement this is a great component!
And use it for #2382.

@oliviertassinari
Copy link
Member

@frankf-cgn I'm done, could you have a look at the other PR?
I think that we are on the right track 😬

@frankf-cgn
Copy link
Author

@oliviertassinari Thats awesome! I'll look into the other PR.

@zannager zannager added the docs Improvements or additions to the documentation label Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to the documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants