safe.d.ts 963 B

12345678910111213141516171819202122232425262728
  1. /**
  2. * Make a string safe for embedding in markdown constructs.
  3. *
  4. * In markdown, almost all punctuation characters can, in certain cases,
  5. * result in something.
  6. * Whether they do is highly subjective to where they happen and in what
  7. * they happen.
  8. *
  9. * To solve this, `mdast-util-to-markdown` tracks:
  10. *
  11. * * Characters before and after something;
  12. * * What “constructs” we are in.
  13. *
  14. * This information is then used by this function to escape or encode
  15. * special characters.
  16. *
  17. * @param {State} state
  18. * Info passed around about the current state.
  19. * @param {string | null | undefined} input
  20. * Raw value to make safe.
  21. * @param {SafeConfig} config
  22. * Configuration.
  23. * @returns {string}
  24. * Serialized markdown safe for embedding.
  25. */
  26. export function safe(state: State, input: string | null | undefined, config: SafeConfig): string;
  27. export type SafeConfig = import('../types.js').SafeConfig;
  28. export type State = import('../types.js').State;