You can turn parts of a code snippet into links to internal or external pages. To do that, define references in a CSV file, using a two column format: . JSON format is also supported expression, link constructor, https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/constructor usefulAction, example-references/api#useful-action :include-file: file-name.js {referencesPath: "references/references-demo.csv"} class JsClass { constructor() { usefulAction(); } } export default JsClass;
Use plugin Page Local Defaults to set references file that is relevant to the page at hand.
Add references to or if you want all your code snippets to use the same references. references.csv references.json { "fapi.book": "example-references/api#book", "fapi.query": "example-references/api#query" } import * as fapi from 'flight-api' function bookFlight(flightInfo) { const confirmation = fapi.book(flightInfo) //... } function flightStatus(id) { const fullStatus = fapi.query(id) return fullStatus.shortStatus }
Inlined code is automatically converted into a link if its content matches one of the global references entries: Use to book a flight. fapi.book Use `fapi.book` to book a flight.