Skip to content

Instantly share code, notes, and snippets.

@sketchytech
Last active March 22, 2016 16:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sketchytech/c06513e115a91e2a0d6a to your computer and use it in GitHub Desktop.
Save sketchytech/c06513e115a91e2a0d6a to your computer and use it in GitHub Desktop.
Apple News Format: Inline Text Styles
{
"version": "1.1",
"identifier": "sketchyTech_Demo",
"title": "My First Article",
"language": "en",
"layout": {},
"components": [{
"role": "title",
"text": "My First Article",
"textStyle": "titleStyle",
"inlineTextStyles": [{
"rangeStart": 3,
"rangeLength": 5,
"textStyle": {
"textColor": "#FF00007F"
}
}]
}, {
"role": "body",
"format": "markdown",
"text": "This is just _over_ the minimum amount of JSON required to create a valid article in **Apple News Format**. If you were to delete the dictionary enclosing this text, you'd be there.",
"textStyle": "bodyStyle"
}],
"componentTextStyles": {
"titleStyle": {
"textAlignment": "center",
"fontName": "HelveticaNeue-Bold",
"fontSize": 64,
"lineHeight": 74,
"textColor": "#000"
},
"bodyStyle": {
"textAlignment": "left",
"fontName": "Georgia",
"fontSize": 18,
"lineHeight": 26,
"textColor": "#000"
}
}
}
@sketchytech
Copy link
Author

Once you have the basic structure in place for your Apple News Format article, and the component text styles for your paragraph style formatting, you can then use either markdown or inline text styles for local formatting. To use markdown in any of your components simply add a format key with the value markdown. To use inline text styles add an inlineTextStyles key to your text component, the value of which will be an array of inline text styles.

Note: local styles are only applied to components that have a component text style and when you have markdown applied all inline text styles are ignored for that component.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment