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

Support "-" (dash) in name of code block lang #244

Closed
ghost opened this issue Apr 18, 2015 · 7 comments
Closed

Support "-" (dash) in name of code block lang #244

ghost opened this issue Apr 18, 2015 · 7 comments
Assignees
Labels

Comments

@ghost
Copy link

@ghost ghost commented Apr 18, 2015

Hi @gettalong,

are you going to accept a PR which makes it possible to use a dash in the code block language?

~~~ mermaid-graph
~~~

Maybe it's just this line which needs to be changed to

FENCED_CODEBLOCK_MATCH = /^((~){3,})\s*?(\w+-)?\s*?\n(.*?)^\1\2*\s*?\n/m
@gettalong gettalong self-assigned this Apr 19, 2015
@gettalong
Copy link
Owner

@gettalong gettalong commented Apr 19, 2015

Yes, I would accept it. I still have to have a look at the code to determine if this would have a side effect but I don't think so.

The change should be backwards-compatible because valid fenced code blocks are not affected.

@maxmeyer
Copy link
Contributor

@maxmeyer maxmeyer commented Apr 19, 2015

I opened a new PR using my private account.

@gettalong
Copy link
Owner

@gettalong gettalong commented Apr 20, 2015

@maxmeyer Just one question before we go further: Wouldn't it be easier to just use an underscore instead of a dash in your custom language? Or is there another reason?

@maxmeyer
Copy link
Contributor

@maxmeyer maxmeyer commented Apr 20, 2015

Wouldn't it be easier to just use an underscore instead of a dash in your custom language?

To make it short: It's a reason for style and maybe compatibility with concurrent frameworks.

I would like to integrate mermaid into middleman-presentation via "code blocks":

~~~
graph TD;
A-->B;
A-->C;
B-->D;
C-->D;
~~~

I'm using a custom kramdown code block converter already so I'm able to generate the HTML stuff in a way I need.

Using code blocks raise a problem "for me": What if a user wants to highlight the mermaid code instead of rendering a graph? It looks like the guys over here decided to use something like this to make it possible:

~~~ mermaid-graph
graph TD;
A-->B;
A-->C;
B-->D;
C-->D;
~~~

Personally I like the mermaid-graph-thing because I use the dash as delimiter and the underscore where text belongs together but whitespace cannot be used: "20140101-this_is_a_text"

@maxmeyer
Copy link
Contributor

@maxmeyer maxmeyer commented Apr 20, 2015

BTW:
There seem to be some programming languages in the wild whose name include a dash. middleman-presentation depends on highlight.js for syntax highlighting. If the developers add one of those languages it could not be used with middleman-presentation. And as I'm very happy with kramdown, I don't want to switch the markdown-parser.

@gettalong
Copy link
Owner

@gettalong gettalong commented Apr 20, 2015

Okay, thanks for explaining your reasons.

@gettalong
Copy link
Owner

@gettalong gettalong commented Apr 20, 2015

Thanks for everything, your changes from #246 are now in master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants