@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.
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ā.
@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.