-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Cocos2d-x feature guides (#1094)
- Loading branch information
Showing
89 changed files
with
3,679 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,5 @@ exceptions: | |
- AAR | ||
- CPU | ||
- IDE | ||
- SKAN | ||
- SKAD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
MUST | ||
MUST NOT | ||
REQUIRED | ||
SHALL | ||
SHALL NOT | ||
SHOULD | ||
SHOULD NOT | ||
RECOMMENDED | ||
NOT RECOMMENDED | ||
MAY | ||
OPTIONAL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import markdoc from "@markdoc/markdoc"; | ||
const { Tag } = markdoc; | ||
|
||
/** | ||
* A function to transform checkbox markers ([ ] and [x]) into checkboxes | ||
* @param children The child elements of the list item | ||
* @returns Updated children with checkboxes added if necessary | ||
*/ | ||
function transformListItemChildren(children) { | ||
return children.flatMap((child, index) => { | ||
if (typeof child === 'string' && index === 0) { | ||
if (child.startsWith("[ ]")) { | ||
return [ | ||
new Tag("input", { type: "checkbox" }, []), | ||
child.slice(3).trim() | ||
]; | ||
} else if (child.startsWith("[x]")) { | ||
return [ | ||
new Tag("input", { type: "checkbox", checked: "", }, []), | ||
child.slice(3).trim() | ||
]; | ||
} | ||
} else if (child instanceof Tag) { | ||
// Recursively call this function on nested lists | ||
return new Tag(child.name, child.attributes, transformListItemChildren(child.children)); | ||
} | ||
|
||
return child; | ||
}); | ||
} | ||
|
||
export const list = { | ||
children: ['item'], | ||
attributes: { | ||
ordered: { type: Boolean, default: false }, | ||
marker: { type: String } | ||
}, | ||
transform(node, config) { | ||
const attributes = node.transformAttributes(config); | ||
const children = node.transformChildren(config); | ||
// If it's an ordered list, do nothing | ||
if (attributes.ordered) return new Tag("ol", attributes, children.map(child => new Tag("li", {}, child.children))); | ||
|
||
// If the list is unordered, apply the transformation | ||
return new Tag("ul", attributes, children.map(child => { | ||
// Transform each list item | ||
const listItemChildren = transformListItemChildren(child.children); | ||
return new Tag("li", {}, listItemChildren); | ||
})); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 9 additions & 1 deletion
10
...docs/sdk/cocos2dx/features/ad-revenue.mdx → ...s/sdk/cocos2dx/v4/features/ad-revenue.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 9 additions & 1 deletion
10
...ontent/docs/sdk/cocos2dx/features/att.mdx → ...ent/docs/sdk/cocos2dx/v4/features/att.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 9 additions & 1 deletion
10
...ocs/sdk/cocos2dx/features/attribution.mdx → .../sdk/cocos2dx/v4/features/attribution.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 9 additions & 1 deletion
10
.../docs/sdk/cocos2dx/features/callbacks.mdx → ...cs/sdk/cocos2dx/v4/features/callbacks.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 9 additions & 1 deletion
10
...ocs/sdk/cocos2dx/features/device-info.mdx → .../sdk/cocos2dx/v4/features/device-info.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.