Skip to content

Commit

Permalink
fix: Add deprecation warnings to markdown docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ksentak committed Oct 23, 2024
1 parent 022363b commit d5ebc27
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
9 changes: 8 additions & 1 deletion languages/markdown/templates/methods/default.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
### ${method.name}
${if.deprecated}
[Deprecated] This method is deprecated as of ${method.deprecation}. ${if.method.alternative}Please use `${method.alternative}` as a replacement.${end.if.method.alternative}

```typescript
${method.signature}
```
${end.if.deprecated}
${if.not.deprecated}
${method.summary}

```typescript
Expand All @@ -17,5 +24,5 @@ ${method.capabilities}
#### Examples

${method.examples}

${end.if.not.deprecated}
---
8 changes: 7 additions & 1 deletion languages/markdown/templates/methods/event.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
### ${event.name}

${if.deprecated}
[Deprecated] This method is deprecated as of ${method.deprecation}. ${if.method.alternative}Please use `${method.alternative}` as a replacement.${end.if.method.alternative}
${end.if.deprecated}

${if.not.deprecated}

```typescript
function listen('${event.name}', ${event.signature.params}${if.context}, ${end.if.context}(${event.result.type}) => void): Promise<number>
```
Expand All @@ -16,5 +22,5 @@ ${method.capabilities}
#### Examples

${method.examples}

${end.if.not.deprecated}
---
4 changes: 0 additions & 4 deletions languages/markdown/templates/schemas/schemas/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,8 @@ title: ${info.title}

# ${info.title}
---
Version ${info.version}

## Table of Contents
${toc}

## Overview
${info.description}

/* ${SCHEMAS} */
5 changes: 5 additions & 0 deletions src/macrofier/engine.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1525,10 +1525,15 @@ function insertMethodMacros(template, methodObj, json, templates, type = '', exa


if (method.deprecated) {
if (method.alternative) {
template = template.replace(/\$\{if\.method\.alternative\}(.*?)\$\{end\.if\.method\.alternative\}/gms, '$1')
}
template = template.replace(/\$\{if\.deprecated\}(.*?)\$\{end\.if\.deprecated\}/gms, '$1')
template = template.replace(/\$\{if\.not\.deprecated\}(.*?)\$\{end\.if\.not\.deprecated\}/gms, '')
}
else {
template = template.replace(/\$\{if\.deprecated\}(.*?)\$\{end\.if\.deprecated\}/gms, '')
template = template.replace(/\$\{if\.not\.deprecated\}(.*?)\$\{end\.if\.not\.deprecated\}/gms, '$1')
}

// method.params[n].xxx macros
Expand Down

0 comments on commit d5ebc27

Please sign in to comment.