6

Here's a pickle: reference style links in markdown are fantastic. Numbered footnotes, however, can be a pain. Named references are a beautiful solution, but the editor seems to choke on them in certain contexts, throwing an error:

your post appears to contain code that is not properly formatted as code...

I've looked at a related question and tested it out quite a bit and I'm pretty sure line breaking isn't the problem, named references are valid markdown, and I can get multi-word named references to work basically every time (in this post, even). Is there a reason for named references to be seen as improperly formatted code in certain contexts?

At the risk of being verbose (but for the sake of completeness), here's the source of the specific question I was trying to post when I encountered the problem:

I'm trying to build a [Google Apps Script] that integrates with [Trello], the idea being to use it to push information from spreadsheets and forms into the [Trello API] and create cards on a `pending` list on a certain board.

I found this [question] on here that pointed me in the right direction, and added in OAuth based on the [GAS OAuth Documentation]. The problem is I can't post the the board. I run the script, the OAuth prompt fires, and the script completes with no errors. I can also `GET` data from the private board, so I assume the authorization is working properly.

So, what am I doing wrong that prevents my script from `POST`ing to Trello?

Here's the code I'm working with:

    var trelloKey = [Trello API key];
    var trelloSecret = [Trello API key secret];
    var trelloList = [the id of the list we're posting to];

    var oauthConfig = UrlFetchApp.addOAuthService('trello');
        oauthConfig.setAccessTokenUrl('https://trello.com/1/OAuthGetAccessToken');
        oauthConfig.setRequestTokenUrl('https://trello.com/1/OAuthGetRequestToken');
        oauthConfig.setAuthorizationUrl('https://trello.com/1/OAuthAuthorizeToken');
        oauthConfig.setConsumerKey(trelloKey);
        oauthConfig.setConsumerSecret(trelloSecret);

    function createTrelloCard() {

      //POST [/1/cards], Required permissions: write
      var payload = {'name': 'apiUploadedCard', 
                     'desc': 'description', 
                     'pos': 'top', 
                     'due': '', 
                     'idList': trelloList};

      var url = 'https://api.trello.com/1/cards'
      var options = {'method' : 'post',
                     'payload' : payload,
                     'oAuthServiceName' : 'trello',
                     'oAuthUseToken' : 'always'};

      UrlFetchApp.fetch(url, options);
    }

[Trello]: http://trello.com
[Google Apps Script]: https://developers.google.com/apps-script/
[Trello API]: https://trello.com/docs/
[other question]: http://stackoverflow.com/questions/18710641/trello-api-how-to-post-a-card-from-google-apps-script-gas
[GAS OAuth Documentation]: https://developers.google.com/apps-script/guides/services/external#making_requests_to_services_with_oauth

If I'm being a complete dunce, please let me know. It seems like one of those errors where it's either a hardcore backend bug or a really stupid user mistake and I'm ready to admit to the latter.

4
  • Would you mind including the exact message shown by the site when you tried to post that? Wouldn't want people to accidentally post this as a question on accident just to figure out what the message was. Nov 22, 2013 at 22:39
  • @JeffMercado I included the first line of the message (verbatim) in the blockquote above, second paragraph. The rest of the message is helptext, but I can add it if deemed necessary.
    – justin
    Nov 22, 2013 at 22:43
  • I tested this with a sockpuppet account (1 rep) and the exact error message came up as said here: "Your post appears to contain code that is not properly formatted as code. Please indent all code by 4 spaces using the code toolbar button or the CTRL+K keyboard shortcut. For more editing help, click the [?] toolbar icon." Using the [shorthand][] format does not work either, nor does being crazy and [repeating yourself][repeating yourself] work. Nov 22, 2013 at 22:57
  • 1
    I was able to post the question by changing all of the links to use the numbered reference style [link][1], so there's that. Definitely not a solution, but a potentially useful fact.
    – justin
    Nov 22, 2013 at 23:03

0

Browse other questions tagged .