Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@example with immediate code block needs newline #324

Closed
lorenzolewis opened this issue Jun 29, 2022 · 4 comments
Closed

@example with immediate code block needs newline #324

lorenzolewis opened this issue Jun 29, 2022 · 4 comments

Comments

@lorenzolewis
Copy link
Contributor

We have a TS document in the following format:

/**
 * Gets the application version.
 * @example
 * ```typescript
 * import { getVersion } from '@tauri-apps/api/app';
 * const appVersion = await getVersion();
 * ```
 *
 * @returns A promise resolving to the application version.
 */
async function getVersion(): Promise<string> {
  return invokeTauriCommand<string>({
    __tauriModule: 'App',
    message: {
      cmd: 'getAppVersion'
    }
  })
}

With the above, the plugin is not adding the appropriate newline between @example and the beginning of the code block which is causing the output code to render like this:

**`example`** ```typescript
import { getName } from '@tauri-apps/api/app';
const appName = await getName();
tgreyuk added a commit that referenced this issue Jun 30, 2022
@tgreyuk
Copy link
Member

tgreyuk commented Jun 30, 2022

Thanks - Fix in [email protected]

@lucasfernog
Copy link

Works like a charm, thanks!

@tgreyuk tgreyuk closed this as completed Jun 30, 2022
@ekoleda-codaio
Copy link

ekoleda-codaio commented Jul 5, 2022

The fix seems to add an extra space before the starting triple-backtick though, as seen in your own test case:

**\`Example\`**

 \`\`\`typescript
import { getVersion } from '@tauri-apps/api/app';
const appVersion = await getVersion();
\`\`\`

This is breaking rendering in my case (mkdocs), although perhaps other markdown renders allow some starting whitespace?

@tgreyuk
Copy link
Member

tgreyuk commented Jul 5, 2022

You are right :) - have updated in ([email protected])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants