CommonMark testing started here!

There is a mathjax plugin, though if you’re hosted here, that doesn’t help you.

We probably plan to add mathjax to business and up, just need to figure out how to make it light weight enough. After I am done implementing the bbcode plugin I will move to mathjax. Also katex is a reasonable middle-ground which I will explore.

5 Likes

In 99.9% such issues are caused by poor languages support by native JS regexps.

linkify-it/re.js at master · markdown-it/linkify-it · GitHub - this can be used as example of how to replace “ordinary” javascript regexps with proper black magic.

Since all required unicode constants already available via markdown-it / linkify-it, it should not be difficult to fix hashtag plugin.

2 Likes

Kick me, when you find good concept for math expressions. When i investigated this topic, i found 3 problems and postponed everything until better times:

  1. No inline syntax (only block one) for math in commonmark
  2. What dialect to use, how to select?
    • TeX is cool, but asciimath much more simple for ordinary users
    • How can user switch the dialect when asciimath is not enougth?
  3. Custom fonts required. How to load those only when necessary.
6 Likes

Somelink - just another link on the internet :arrow_backward: fails cause of the tag category plugin

2 Likes

OK, I took a shot at the plugin.

For now:

  1. I used $ and the jgm suggested heuristic as to handle cases like 100$ + 200$

  2. I selected TeX cause that is what math.stackexchange.com seem to use so there is lots of prior art.

  3. I embedded the fonts in the plugin, and load on demand.

6 Likes

On Monday we (I) plan to deploy this change to the Standard Tier :confetti_ball: :star_struck: :fairy:

8 Likes

Found a slightly weird thing - for some reason this doesn’t get recognised as a mention

This is a line of text
@sam

This is a line of text
@sam


But this works fine

This is a line of text

@sam

This is a line of text

@sam

4 Likes

Could you explain details, why $inline$ syntax will have no conflicts?

  • what if equation has $ inside (as part of variable name, comment etc)?
  • on math.stackexchange.com i’ve seen that all spaces are replaced with underlines in sources. Is this a mandatory requirement to avoid collisions?
3 Likes

Yeah, that next line is impacting my plugin as well :frowning:

@sam, I do have another issue I’m struggling to work around. It seems markdown-it is only getting setup when the composer is open. My main plugin, is the checklist plugin. Everything works fine when the composer was opened and then closed (without refreshing the page)

Knowing that doesn’t probably make a lot of sense, here is a video of it
http://nimb.ws/UNn5gb

The error I receive is

Error: Could not find module `pretty-text/engines/markdown-it/helpers` imported from `discourse/plugins/discourse-plugin-checklist/lib/discourse-markdown/checklist`
    at requireFrom (discourse-loader:128)
    at reify (discourse-loader:106)
    at mod.state (discourse-loader:163)
    at tryFinally (discourse-loader:30)
    at require (discourse-loader:162)
    at eval (pretty-text/engines/discourse-markdown-it:208)
    at Array.forEach ()
    at setup (pretty-text/engines/discourse-markdown-it:206)
    at buildOptions (pretty-text/pretty-text:93)
    at getOpts (discourse/lib/text:23)

What is mind-boggling is it works just fine once the composer is opened and then closed. It only fails to find said helper import if the composer is never opened (you don’t have to type anything in the composer either).

Here is the code I’ve come up with thus far.

The error is being generated from (which I did not alter for markdown-it – not sure I need to)

Edited: Changed the video URL, as I didn’t realize the dev tools was not captured.

4 Likes

I’ve got to say that this is probably my absolute favourite improvement that this new engine brings – being able to use double hyphens to produce spaced en dashes is amazing.

Out of curiosity, why the decision to disable the typographer by default? Is it likely to cause issues in languages other than English? Or is it out of fear of breaking existing content on rebake? Given that Discourse is primarily about the reading experience, I think it’d be good to by default enable features like the typographer which improve legibility.

We circled back on this, we may enable it by default in a few weeks, just living with it for a bit now

5 Likes

you would escape it like so: $\$a$

I really do not think so, can you think of an example where this is needed?

No, i just seen something strange on math.stackexchange and asked question about reasons, because you have more experience in this area

Very marginally, I have only been doing MathJax for a few days :mage: :blush:

1 Like

Yeah, you have to use cookAsync from now on, will check in a deprecation message there.

So your new code would be something like:

  let props = {
     raw: new_raw,
     edit_reason: 'checklist change',  
  };

  cookAsync(new_raw).then(cooked => {
      props.cooked = cooked.string;  
      viewPost.save(props);
  });
      

3 Likes

Will image alignment be made possible with commonmark?

Not much progress in the CommonMark world there…

But … since we already only use HTML based image metadata, whitelisting a few classes is super easy in a plugin.

@codinghorror I wonder if we should just whitelist a few here out of the box?

2 Likes

We are back to no open bugs per:

and

4 Likes

Cool - thanks for thinking about image alignment, which may seem unimportant in the grand scheme of things but would be a big help to us.

Right now, my colleague is trying to display some profile pictures with biographical details attractively over here on my discourse.

Interestingly, I was able to get something close to attractive on the commonmark.js demo site:

Here’s the code I used to create that:

[<img src="https://community.namati.org/uploads/default/original/2X/4/44c8fd629b36d97fe0c6e618fc99bb84497768bd.jpg" width="170" height="125" align="left">](https://namati.org/network/member/LucyClaridge) Lucy Claridge (@LucyClaridge)  is Legal Director at Minority Rights Group International, where she manages the legal department.  Her work uses strategic litigation, advocacy and capacity building to improve access to justice for minority and indigenous communities worldwide, with a particular focus on land rights, political participation and wider anti-discrimination issues.  Casework includes the recent Ogiek land and conservation case against Kenya before the African Court of Human and Peoples' Rights.