Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 153 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

Trying to post to Stack Overflow I get a "Your post appears to contain code that is not properly formatted as code."

I believe all code in my post is properly formatted; I tried various changes without success. Any help would be appreciated. The verbatim source of the query is:

<!-- language-all: lang-js -->
Trying to create a [tag:Sencha-Touch-2] app syncing to a [tag:Node.js] server; code below. 
The server uses another port on the same IP, so this is [tag:cross-domain].

- Using a [tag:JSONP] Proxy as shown can read data from the server but breaks when writing: 
*"JSONP proxies can only be used to read data"*. 
I guess the JSONP Proxy writer config is just to write the query and isn't used to write sync (save).

- Sencha docs state an **[tag:Ajax]** proxy can't go cross-domain, even though a
Cross-domain Ext.Ajax/ is discussed in [the Sencha forums](

- I have found several ways to do a (cross-domain) JSON post (e.g.
but don't know how to integrate this as a writer in a proxy which syncs my store.
seems to offer pointers, but this is ajax and apparently unsuited for cross domain.

I've been reading this forum and elsewhere for a couple of days, but I seem to be stuck. Any help would be much appreciated.

Node.js and restify server
*(The server uses Mongoose to talk to a MongoDB back-end (not shown))*

    var server = restify.createServer({
      name: 'Server',
      key: fs.readFileSync(root+'/'+'privatekey.pem'),
      certificate: fs.readFileSync(root+'/'+'certificate.pem')


    function getMessages(req, res, next) {
      Model.find(function (err,data) {
        res.setHeader('Content-Type', 'text/javascript;charset=UTF-8');
        res.send(req.query["callback"] + '({"records":' +  JSON.stringify(data) + '});');

    function postMessage(req, res, next) {//not yet tested
      var obj = new Model(); =;
      obj.description = req.params.description; = new Date(); (err) {
            if (err) throw err;
    }^\/atapp/, postMessage);
    server.get(/^\/atapp/, getMessages);

    server.listen(port, ipaddr, function() {
        console.log('%s: secure Node server started on %s:%d ...', Date(, ipaddr, port);

Sencha Touch 2

    Ext.define('ATApp.model.User', {
        extend: '',
        config: {
            fields: [
                { name: 'name',  type: 'string' },
                { name: 'description', type: 'string' },
                { name: 'date',  type: 'date' },
                { name: '_id' }


    Ext.define('', {
        extend: '',
        requires: [
        config: {
            autoLoad: true,
            model: 'ATApp.model.User',
            storeId: 'Data',
            proxy: {
                type: 'jsonp',  
                model: 'ATApp.model.User',
                url: '',
                reader: {
                    type: 'json',
                    idProperty: '_id',
                    rootProperty: 'records',
                    useSimpleAccessors: true
                writer: {
                    type: 'json',
                    allowSingle: false,
                    encode: true,
                    idProperty: '_id',
                    rootProperty: 'records'


    onNewDataRecord: function (view) {
                            var now = new Date();
                            var record = Ext.create('ATApp.model.User', {
                                date: now,
                                name: '..',
                                description: '..'
                            var store ='Data')
share|improve this question
There's quite a bit of non-text stuff in the description part. Try removing all the [tag] things (they're really not necessary, just put the properly capitalized product names in plain text), put "Ext.Ajax/" in backticks, and maybe, move the URLs out of line. – Mat Sep 23 '12 at 7:24
Try to move the <!-- language-all: lang-js --> just above the actual code blocks. And be sure to leave a blank above and below that. Or just is out altogether; I guess the JavaScript tag is present anyway? (As an aside: I don't think the [tag:xx] is helpful at all; just noise for the reader, I feel. Also, you might want to unindent the last block a bit.) – Arjan Sep 23 '12 at 7:33
@Mat, @Arjan: I've tried your suggestions without luck. They make sense anyway so thanks all the same. (Leaving out <!-- language-all: lang-js --> altogether turns off syntax highlighting in the preview) – Pum Walters Sep 23 '12 at 7:57
@Pum to have a "global" syntax highlight just add proper tag, don't worry about the preview worst case you can edit later and fix this. – Shadow Wizard Sep 23 '12 at 8:03
Can't answer my own question (no reputation), so I'll add is as comment: Solved; the offending line was *(The server uses ...)* between the first header and the actual code. – Pum Walters Sep 23 '12 at 8:07

You must log in to answer this question.

Browse other questions tagged .