Troubles with Discourse

@Bob_Carpenter let me know if the new settings .Ake it better.

functions {
  real foo(real x) { return x * 2; }
}
data {
  int[10] x;
}
parameters {
  real<lower=0, upper=1> theta;
}
model {
  x ~ bernoulli_logit(theta);
}

Much better! Thanks.

1 Like

Is there a way/would it be useful to include in the new topic templates a little example blurb of how to use the backticks for code?

Thereā€™s been a couple new posts where it woulda made them a lot easier to digest. It makes it easy when folks just do code dumps, but man markdown can mess up the formatting if itā€™s outside the preformatted blocks.

Yes, please!

If you look at this, you see that the auto-formatting messes up when we run it on anything other than Stan models. Hereā€™s an example from

> stanout <- stan('latent-factor-model.stan'
+               , data=standat
+               , iter=4000
+               , chains=1)
...
C:/Users/CURTS025/programs/R/library/BH/include/boost/config/compiler/gcc.hpp:186:0: warning: "BOOST_NO_CXX11_RVALUE_REFERENCES" redefined
#  define BOOST_NO_CXX11_RVALUE_REFERENCES
^
<command-line>:0:0: note: this is the location of the previous definition
 
SAMPLING FOR MODEL 'latent-factor-model' NOW (CHAIN 1).

I think the formatting is hurting more than helping here.

Is there a way to just turn off highlighting? Or make it configurable, with the default being no highlighting?

testing out formatting with explicit R block

> stanout <- stan('latent-factor-model.stan'
+               , data=standat
+               , iter=4000
+               , chains=1)
...
C:/Users/CURTS025/programs/R/library/BH/include/boost/config/compiler/gcc.hpp:186:0: warning: "BOOST_NO_CXX11_RVALUE_REFERENCES" redefined
#  define BOOST_NO_CXX11_RVALUE_REFERENCES
^
<command-line>:0:0: note: this is the location of the previous definition
 
SAMPLING FOR MODEL 'latent-factor-model' NOW (CHAIN 1).

For those following at home, I looked at @syclikā€™s source and it is formatted as:

```R
model 123
```

which produces

model 123

whereas

```
model 123
```

produces

model 123

edit: I detest markdown and every other broken non-recursive formatting system. I canā€™t figure out how to get a pre block. It looked OK in preview then went bonkers when I hit ā€œsave editā€.

1 Like

@Bob_Carpenter, thereā€™s a way to explicitly set the language:
https://help.github.com/articles/creating-and-highlighting-code-blocks/

Itā€™s triple backticks with the language right after. The list of all available languages:
https://highlightjs.org/static/demo/

Thereā€™s also the default language, which I changed from ā€œautoā€ to ā€œstanā€ because if we left it as auto, it doesnā€™t highlight Stan code properly.

I could set the default to plain text so thereā€™s no colors and only when the poster sets a language explicitly weā€™d get pretty text.

(Sorry, this was in my drafts. I never used the pre tags, just triple back ticks with the language right after.)

Thanks. This seems to imply that Discourse is using GitHub markdown. Is that right?

I think it might be easier if we just left the default as plain text given that our users have no way of figuring out how to markup a given block of text and the Stan highlighting isnā€™t particularly helpful.

```R
foo bar baz
```

Looks like the first use of <pre> will work, but when you try to follow it with triple back-tick escaped text, it goes wild.

No, I donā€™t think itā€™s using github markdown, but I donā€™t have a reference for what it actually uses. I know that the code blocks are the same, though, and that was the clearest description of how to specify language that I could find on a Google search.

And sure, we can set the default to plain text.

Thanks. And please use your own judgement about what to doā€”Iā€™m just expressing my own preferences here, not trying to tell eveyone what to do!

I like bad highlighting more than no highlighting. I changed a setting; hopefully it works.

model { }

And is it easy to change the new post template for models to include something like:

[Please include Stan program and accompanying data if possible]

```
[Fill in any preformatted text here]
```

```stan
[Fill in Stan code here]
```

Hereā€™s to hoping this formats correctly!

Not so much a problem as a solution. I was missing all replies as ā€œnewā€ until I went in and configured my message tracker to follow all topics, not just the ones in which Iā€™m involved. Now I have 35+ threads to catch up on!

Iā€™m still having trouble tracking Discourse topics. Does anyone know a way that I can list all of the topics with posts in them that I havenā€™t read? I can just keep scrolling, but the interface is super clunky and slow for that and back doesnā€™t work.

When I look at the main page I get an ā€œunreadā€ button that works well.

For me, that only includes topics to which Iā€™ve replied. Otherwise, what I get is that it first shows up in ā€œnewā€, then if I look at it and never respond, I never see it again. Itā€™s not in ā€œnewā€ or ā€œunreadā€ after that.

I see, I guess I didnā€™t notice because if posts are off-topic for me I let them sink and only sometimes bother catching up. Would be nice if it worked better.