markdownapple-news

Apple news JSON format and links in markdown


I'm using markdown syntax for content in apple news articles published in their JSON format. What I've noticed is that links are correctly parsed but link text doesn't show in blue (or in any other color that helps to highlight links from normal text). As I know, it's not possible to add further styling when you use markdown format so I'm not sure what else I need to style links.

Is there any other trick to accomplish links in blue? or is it a kind of bug in News app?

Thanks.


Solution

  • Styling for Apple News files are done by using Text Styles and Component Text Styles.

    The example provided in the latter is for exactly what you want, i.e. how to style links:

    {
      "fontName": "GillSans-Bold",
      "fontSize": 12,
      "lineheHeight": 15,
      "paragraphSpacingBefore": 20,
      "paragraphSpacingAfter": 20,
      "textColor": "#000000",
      "textAlignment": "right",
      "lineHeight": 14,
      "firstLineIndent": 20,
      "linkStyle": {
        "underline": {
          "color": "#2a6496"
        }
      }
    }
    

    These text styles can either be placed in the textStyles property of your article, or inline.

    {
      "role": "body",
      "text": "Lorem *ipsum*",
      "textStyle": {AS ABOVE}
    }
    

    Hope that helps!