Code

Code highlights short strings of code snippets inline with body text.

20.0.0

Major Changes

Patch Changes

  • Updated dependencies

19.2.5

Patch Changes

  • Updated dependencies

19.2.4

Patch Changes

  • Updated dependencies

19.2.3

Patch Changes

  • Updated dependencies

19.2.2

Patch Changes

19.2.1

Patch Changes

19.2.0

Minor Changes

Patch Changes

  • Updated dependencies

19.1.0

Minor Changes

  • d82e6f76528ab, (opens new window) - Add direct subpath package exports as part of the linking-platform, search, media, and design-system barrel-removal (de-barrel) migration.

    These packages now expose their individual modules via explicit package.json exports subpaths so that consumers can import directly from the leaf module (e.g. @atlaskit/pkg/thing) instead of the package barrel/index. This adds new public entry points without changing or removing any existing exports, so it is a backwards-compatible additive change.

    No runtime behaviour changes; this is an API-surface (entry-point) addition to support tree-shaking and to unblock removal of the barrel index files.

Patch Changes

  • Updated dependencies

19.0.0

Major Changes

  • 11ace7dc73878, (opens new window) - Apply Volt entry-point and multi-export standards via volt-migrate-package. This is a major change to @atlaskit/code: the package exports map has been restructured so every public subpath now resolves directly to its ./src/* implementation instead of going through an intermediate ./src/entry-points/* re-export. It also introduces new public subpaths: @atlaskit/code/bidi-character-regex, @atlaskit/code/bidi-warning/bidi-warning-decorator, @atlaskit/code/internal/types.

    Why this is breaking

    Because each subpath now points straight at its implementation module, a subpath and the package root can resolve to the same module instance. Consumers that deep-import the internal entry-points/* files, or that jest.mock() a specific subpath, may observe changed resolution/behaviour and need updating.

    Migration — public imports are unchanged

    Importing the published subpaths (or the package root) continues to work as before:

    // Still valid — no change required import CodeBlock from '@atlaskit/code/code-block';

    If you were reaching into the internal entry-point modules, switch to the public subpath:

    -import CodeBlock from '@atlaskit/code/entry-points/code-block'; +import CodeBlock from '@atlaskit/code/code-block';

    Before / after exports map

    "exports": { ".": "./src/index.tsx", + "./bidi-character-regex": "./src/bidi-warning/bidi-character-regex.tsx", "./bidi-warning": "./src/bidi-warning/index.tsx", "./bidi-warning-decorator": "./src/entry-points/bidi-warning-decorator.tsx", - "./bidi-warning-ui": "./src/entry-points/bidi-warning-ui.tsx", + "./bidi-warning-ui": "./src/bidi-warning/ui/index.tsx", + "./bidi-warning/bidi-warning-decorator": "./src/bidi-warning/bidi-warning-decorator.tsx", "./block": "./src/entry-points/block.tsx", - "./code": "./src/entry-points/code.tsx", + "./code": "./src/code.tsx", - "./code-block": "./src/entry-points/code-block.tsx", + "./code-block": "./src/code-block.tsx", - "./constants": "./src/entry-points/constants.tsx", + "./constants": "./src/constants.tsx", "./inline": "./src/entry-points/inline.tsx", + "./internal/types": "./src/internal/types.tsx", - "./types": "./src/entry-points/types.tsx", + "./types": "./src/types.tsx", }

    The secondary re-exports that remain on multi-export modules (CODE_BLOCK_SELECTOR from ./constants, bidiCharacterRegex from ./bidi-warning-decorator, the ./bidi-warning and ./block shims) are now marked @deprecated, each pointing at the import to use instead. VOLTC-139 tracks their removal.

    Internal type-only imports in the syntax highlighter were also straightened out — AST and RefractorNode are now imported directly from refractor rather than re-exported through ./src/syntax-highlighter/types.tsx. The set of types available from the public ./types subpath is unchanged.

Patch Changes

  • Updated dependencies

18.2.2

Patch Changes

  • Updated dependencies

18.2.1

Patch Changes

  • Updated dependencies

18.2.0

Minor Changes

  • cd097a2111788, (opens new window) - Republish packages depending on @atlaskit/react-compiler-gating so their published dependency reference is updated to the renamed @atlaskit/react-compiler-gating scope.

    The earlier rename of @atlassian/react-compiler-gating to @atlaskit/react-compiler-gating only bumped the renamed package itself, so dependent packages were never republished and their published versions still referenced the old @atlassian/react-compiler-gating name, which is not available in the public npm registry. This minor bump republishes all affected packages with the corrected dependency.

Patch Changes

  • Updated dependencies

18.1.0

Minor Changes

  • 8f42cb78984a2, (opens new window) - Fix markdown code blocks silently dropping HTML/JSX tags when refractor parses embedded sub-language grammars. Safe highlighting behind feature gate platform-code-highlight-markdown-safe.

18.0.1

Patch Changes

18.0.0

Major Changes

  • f2dc9097319f0, (opens new window) - ### Dropped support for legacy Typescript 4 types. Typescript 5 is now the new minimum.

    Removes the typesVersions property and dist/types-ts4.5 directory from the dist.

    Types are now exclusively via the "types": "dist/types/index.d.ts" property.

    - "typesVersions": { - ">=4.5 <4.9": { - "*": [ - "dist/types-ts4.5/*", - "dist/types-ts4.5/index.d.ts" - ] - } - },

Patch Changes

  • Updated dependencies

17.5.1

Patch Changes

  • Updated dependencies

17.5.0

Minor Changes

Patch Changes

  • Updated dependencies

17.4.8

Patch Changes

  • Updated dependencies

17.4.7

Patch Changes

17.4.6

Patch Changes

  • Updated dependencies

17.4.5

Patch Changes

17.4.4

Patch Changes

  • Updated dependencies

17.4.3

Patch Changes

  • Updated dependencies

17.4.2

Patch Changes

  • Updated dependencies

17.4.1

Patch Changes

  • Updated dependencies

17.4.0

Minor Changes

17.3.3

Patch Changes

17.3.2

Patch Changes

17.3.1

Patch Changes

  • Updated dependencies

17.3.0

Minor Changes

17.2.8

Patch Changes

  • Updated dependencies

17.2.7

Patch Changes

17.2.6

Patch Changes

17.2.5

Patch Changes

17.2.4

Patch Changes

17.2.3

Patch Changes

  • Updated dependencies

17.2.2

Patch Changes

17.2.1

Patch Changes

  • Updated dependencies

17.2.0

Minor Changes

17.1.2

Patch Changes

17.1.1

Patch Changes

17.1.0

Minor Changes

Patch Changes

  • Updated dependencies

17.0.0

Major Changes

  • #125263, (opens new window) 1437a53a170e0, (opens new window) - Migrated from @emotion/react to @compiled/react in order to improve performance, align with the rest of the Atlaskit techstack, and support React 18 Streaming SSR.

    Deprecating the getCodeStyles function export from the @atlaskit/code package as it is no longer used.

    Please note, in order to use this version of @atlaskit/code, you will need to ensure that your bundler is configured to handle .css imports correctly. Most bundlers come with built-in support for .css imports, so you may not need to do anything. If you are using a different bundler, please refer to the documentation for that bundler to understand how to handle .css imports.

    For more information on the migration, please refer to RFC-73 Migrating our components to Compiled CSS-in-JS, (opens new window).

Patch Changes

  • Updated dependencies

16.3.0

Minor Changes

16.2.0

Minor Changes

16.1.0

Minor Changes

16.0.3

Patch Changes

16.0.2

Patch Changes

  • Updated dependencies

16.0.1

Patch Changes

  • Updated dependencies

16.0.0

Major Changes

Patch Changes

  • Updated dependencies

15.8.0

Minor Changes

Patch Changes

  • Updated dependencies

15.7.3

Patch Changes

  • Updated dependencies

15.7.2

Patch Changes

15.7.1

Patch Changes

  • Updated dependencies

15.7.0

Minor Changes

Patch Changes

  • Updated dependencies

15.6.10

Patch Changes

15.6.9

Patch Changes

  • Updated dependencies

15.6.8

Patch Changes

15.6.7

Patch Changes

  • Updated dependencies

15.6.6

Patch Changes

15.6.5

Patch Changes

  • Updated dependencies

15.6.4

Patch Changes

15.6.3

Patch Changes

15.6.2

Patch Changes

15.6.1

Patch Changes

  • Updated dependencies

15.6.0

Minor Changes

15.5.1

Patch Changes

  • Updated dependencies

15.5.0

Minor Changes

  • #127511, (opens new window) db30e29344013, (opens new window) - Widening range of react and react-dom peer dependencies from ^16.8.0 || ^17.0.0 || ~18.2.0 to the wider range of ``^16.8.0 || ^17.0.0 || ^18.0.0` (where applicable).

    This change has been done to enable usage of react@18.3 as well as to have a consistent peer dependency range for react and react-dom for /platform packages.

Patch Changes

  • Updated dependencies

15.4.2

Patch Changes

15.4.1

Patch Changes

15.4.0

Minor Changes

15.3.1

Patch Changes

15.3.0

Minor Changes

15.2.1

Patch Changes

15.2.0

Minor Changes

Patch Changes

  • Updated dependencies

15.1.2

Patch Changes

15.1.1

Patch Changes

15.1.0

Minor Changes

15.0.0

Major Changes

14.6.9

Patch Changes

  • Updated dependencies

14.6.8

Patch Changes

14.6.7

Patch Changes

14.6.6

Patch Changes

14.6.5

Patch Changes

14.6.4

Patch Changes

14.6.3

Patch Changes

14.6.2

Patch Changes

14.6.1

Patch Changes

14.6.0

Minor Changes

Patch Changes

  • Updated dependencies

14.5.4

Patch Changes

14.5.3

Patch Changes

14.5.2

Patch Changes

14.5.1

Patch Changes

14.5.0

Minor Changes

  • #30248, (opens new window) f5ca132a05e, (opens new window) - [ux] CodeBlock has had some significant under-the-hood changes in this version. While technically it is a minor update as all API changes are additive and backwards-compatible, this is a heads up that there are some small visual changes that may require visual regression snapshots to be updated.
    • Adds a new shouldWrapLongLines prop that allows you to wrap long lines of code over multiple lines, instead of always forcing the container to scroll horizontally.

    • Fixes a frustrating bug where copying code from CodeBlock would also copy line numbers — this no longer occurs!

    • Replaces the dependency of react-syntax-highlighter with our own implementation that is more maintainable and performant. This also lead to a bump in an underlying dependency prismjs which added new syntax highlighting features for some languages. This may cause some blocks of code to look slightly different, potentially impacting VR tests — some changes are expected! Reach out to #help-design-system if you have any questions.

    • Improves the presentation and security of CodeBlock's with bidirectional characters to present the source code exactly how it was written. The bidirectional characters themselves are still highlighted in the same way as before with a warning and a tooltip. This may also impact VR tests, but is expected.

Patch Changes

  • Updated dependencies

14.4.8

Patch Changes

  • Updated dependencies

14.4.7

Patch Changes

14.4.6

Patch Changes

14.4.5

Patch Changes

  • Updated dependencies

14.4.4

Patch Changes

  • Updated dependencies

14.4.3

Patch Changes

14.4.2

Patch Changes

  • Updated dependencies

14.4.1

Patch Changes

14.4.0

Minor Changes

Patch Changes

  • Updated dependencies

14.3.10

Patch Changes

14.3.9

Patch Changes

14.3.8

Patch Changes

14.3.7

Patch Changes

  • Updated dependencies

14.3.6

Patch Changes

14.3.5

Patch Changes

14.3.4

Patch Changes

  • Updated dependencies

14.3.3

Patch Changes

  • #19019, (opens new window) a1a89347baa, (opens new window) - [ux] Instrumented @atlaskit/code with the new theming package, @atlaskit/tokens.

    New tokens will be visible only in applications configured to use the new Tokens API (currently in alpha). These changes are intended to be interoperable with the legacy theme implementation. Legacy dark mode users should expect no visual or breaking changes.

  • Updated dependencies

14.3.2

Patch Changes

14.3.1

Patch Changes

14.3.0

Minor Changes

14.2.0

Minor Changes

14.1.5

Patch Changes

14.1.4

Patch Changes

  • Updated dependencies

14.1.3

Patch Changes

14.1.2

Patch Changes

14.1.1

Patch Changes

14.1.0

Minor Changes

14.0.1

Patch Changes

14.0.0

Major Changes

  • #10230, (opens new window) e8f66c36dd7, (opens new window) - BREAKING CHANGES

    This version includes several breaking changes to improve performance of the @atlaskit/code package.

    <Code /> no longer supports syntax highlighting, greatly simplifying the component. Additionally, the text prop has been removed in favour of using children directly. This allows users to provide complex nodes (not just plain text) to Code.

    // previous <Code text="const x = 10;" language="js" /> // now with language no longer supported <Code>const x = 10;</Code>

    Component theming is no longer supported in <Code /> or <CodeBlock />; this change does not effect global theming. As an escape hatch, two CSS variables are exposed:

    • --ds--code--line-number-bg-color: which controls the background color of the line numbers if set
    • --ds--code--bg-color: which controls the background color of the block body if set

    Components can now be imported individually using individual entrypoints. Using these entrypoints will reduce the overall bundle size of this package if you do not need both components.

    import { Code } from '@atlaskit/code'; // --> to import Code from '@atlaskit/code/inline'; import { CodeBlock } from '@atlaskit/code'; // --> to import CodeBlock from '@atlaskit/code/block'; // note this will still work import { Code, CodeBlock } from '@atlaskit/code';

    Finally, CodeBlock has had type improvements, and internal optimisations to facilitate faster rendering and updates.

  • 7e091c1d415, (opens new window) - BREAKING CHANGE:

    The codeStyle prop has now been removed on the Code component.

    For reference, previously this type of usage would effect the styling of any numbers in the code text.

    <Code codeStyle={{ number: 'red' }} text={someCode} />

    Due to internal changes the above usage is no longer possible.

    This release also includes internal changes to the syntax highlighting element to use class names instead of inline styles for syntax highlighting. This results in a substantial performance gain.

Minor Changes

  • 07e012bfc5b, (opens new window) - Updates to internal package structure, exposing additional entrypoints. Types also tightened for language support to better match underlying component.

Patch Changes

13.2.3

Patch Changes

13.2.2

Patch Changes

13.2.1

Patch Changes

13.2.0

Minor Changes

  • #7762, (opens new window) 3c7be954dbd, (opens new window) - [ux] Line highlighting now meets WCAG 2.1 guidelines. Colors that were failing contrast have been updated and there is now a new visual cue consisting of a left border to the highlighted lines.

  • 23ef692842a, (opens new window) - [ux] Code and CodeBlock now use react-syntax-highlighter@^15 to highlight code. As part of this change the fontSize for the line numbers and the code body have been normalised. This will be a breaking visual change for all consumers. No action is required other than a callout that this will affect any existing visual regression tests.

    Users can now use the themeOverride prop to customise the application of the default theme. This is an escape hatch which will likley be removed in a future major version.

    This change also includes:

    • A bugfix for lineHeight that meant linenumbers and code body were not vertically aligned correctly.
    • A bugfix for the SSR'd components not rendering consistently before hydration
    • Improved semantic lines, which can now be properly consumed by screen readers.
    • The Code and CodeBlock now expose additional options in their theme prop. These are codeFontSize and codeLineHeight which allow customisation of the component's rendered font size.
  • 7c2f2056ef7, (opens new window) - [ux] Added code syntax highlighting for the following languages: AppleScript, Clojure, Delphi, Diff, FoxPro, Object Pascal, QML, Standard ML, Visual Basic, JSX and TSX

Patch Changes

13.1.1

Patch Changes

13.1.0

Minor Changes

13.0.3

Patch Changes

13.0.2

Patch Changes

  • Updated dependencies

13.0.1

Patch Changes

13.0.0

Major Changes

Patch Changes

12.0.3

Patch Changes

12.0.2

Patch Changes

12.0.1

Patch Changes

12.0.0

Major Changes

Patch Changes

  • Updated dependencies

11.1.6

Patch Changes

11.1.5

Patch Changes

11.1.4

Patch Changes

11.1.3

Patch Changes

11.1.2

Patch Changes

11.1.1

Patch Changes

11.1.0

Minor Changes

  • [minor]9648afc5be, (opens new window):

    Adds highlight prop to AkCodeBlock, Example, and the code template literal. Use this to emphasize which lines of code you would like people to look at!

    The highlight prop can be used as follows:

    • To highlight one line: highlight="3"
    • To highlight sequential lines: highlight="1-5"
    • To highlight sequential and multiple single lines: highlight="1-5,7,10,15-20"

    AkCodeBlock component

    Use the highlight prop.

    import { AkCodeBlock } from '@atlaskit/code'; <AkCodeBlock highlight="1-2" text={` <div> hello there <span>buds</span> </div> `} />;

    Example component

    Use the highlight prop.

    import { Example } from '@atlaskit/docs'; <Example packageName="@atlaskit/code" Component={require('../examples/00-inline-code-basic').default} title="Basic" highlight="19,24,30,36" source={require('!!raw-loader!../examples/00-inline-code-basic')} />;

    code template literal

    Add highlight= to the top of your code snippet. It takes the same values as the highlight prop.

    import { code } from '@atlaskit/docs'; code`highlight=5-7 import React from 'react'; () => ( <div> hello there <span>buds</span> </div> )`;

11.0.14

Patch Changes

11.0.13

Patch Changes

11.0.12

Patch Changes

Mobile - Implement undo/redo interface on Hybrid Editor - https://product-fabric.atlassian.net/browse/FM-2393, (opens new window)

Copy and Paste

- Support copy & paste when missing context-id attr - https://product-fabric.atlassian.net/browse/MS-2344 - Right click + copy image fails the second time that is pasted - https://product-fabric.atlassian.net/browse/MS-2324 - Copying a never touched image for the first time from editor fails to paste - https://product-fabric.atlassian.net/browse/MS-2338 - Implement analytics when a file is copied - https://product-fabric.atlassian.net/browse/MS-2036

Media

Notable Bug Fixes

- Implement consistent behaviour for rule and mediaSingle on insertion - Feature Flag: - allowNewInsertionBehaviour - [default: true] - https://product-fabric.atlassian.net/browse/ED-7503 - Fixed bug where we were showing table controls on mobile. - https://product-fabric.atlassian.net/browse/ED-7690 - Fixed bug where editor crashes after unmounting react component. - https://product-fabric.atlassian.net/browse/ED-7318 - Fixed bug where custom emojis are not been showed on the editor - https://product-fabric.atlassian.net/browse/ED-7726

11.0.11

Patch Changes

  • [patch]097b696613, (opens new window):

    Components now depend on TS 3.6 internally, in order to fix an issue with TS resolving non-relative imports as relative imports

11.0.10

Patch Changes

11.0.9

Patch Changes

11.0.8

Patch Changes

  • [patch]abee1a5f4f, (opens new window):

    Bumping internal dependency (memoize-one) to latest version (5.1.0). memoize-one@5.1.0 has full typescript support so it is recommended that typescript consumers use it also.

11.0.7

Patch Changes

11.0.6

Patch Changes

11.0.5

Patch Changes

11.0.4

Patch Changes

11.0.3

Patch Changes

11.0.2

Patch Changes

11.0.1

  • [patch]b0ef06c685, (opens new window):
    • This is just a safety release in case anything strange happened in in the previous one. See Pull Request #5942 for details

11.0.0

  • [major]97bfe81ec8, (opens new window):
    • @atlaskit/code has been converted to Typescript. Typescript consumers will now get static type safety. Flow types are no longer provided. No API or behavioural changes.

10.0.0

  • [major]7c17b35107, (opens new window):
    • Updates react and react-dom peer dependencies to react@^16.8.0 and react-dom@^16.8.0. To use this package, please ensure you use at least this version of react and react-dom.

9.0.1

9.0.0

  • [major]76299208e6, (opens new window):

    • Drop ES5 from all the flow modules

    Dropping CJS support in all @atlaskit packages

    As a breaking change, all @atlaskit packages will be dropping cjs distributions and will only distribute esm. This means all distributed code will be transpiled, but will still contain import and export declarations.

    The major reason for doing this is to allow us to support multiple entry points in packages, e.g:

    import colors from `@atlaskit/theme/colors`;

    Previously this was sort of possible for consumers by doing something like:

    import colors from `@atlaskit/theme/dist/esm/colors`;

    This has a couple of issues. 1, it treats the file system as API making internal refactors harder, we have to worry about how consumers might be using things that aren't actually supposed to be used. 2. We are unable to do this internally in @atlaskit packages. This leads to lots of packages bundling all of theme, just to use a single color, especially in situations where tree shaking fails.

    To support being able to use multiple entrypoints internally, we unfortunately cannot have multiple distributions as they would need to have very different imports from of their own internal dependencies.

    ES Modules are widely supported by all modern bundlers and can be worked around in node environments.

    We may choose to revisit this solution in the future if we find any unintended condequences, but we see this as a pretty sane path forward which should lead to some major bundle size decreases, saner API's and simpler package architecture.

    Please reach out to #fabric-build (if in Atlassian) or create an issue in Design System Support, (opens new window) (for external) if you have any questions or queries about this.

8.2.3

8.2.2

8.2.1

8.2.0

8.1.1

8.1.0

8.0.12

8.0.11

8.0.10

8.0.9

8.0.8

8.0.7

8.0.6

8.0.5

8.0.4

8.0.3

8.0.1

8.0.0

7.0.3

7.0.2

7.0.1

7.0.0

6.0.1

6.0.0

5.0.4

5.0.3

5.0.2

5.0.1

5.0.0

4.0.4

4.0.3

4.0.1

4.0.0

3.1.2

3.1.1

3.1.0

3.0.6

3.0.5

3.0.4

3.0.3

  • Manual bump to resolve desync with npm package version.

3.0.2

3.0.1

3.0.0

2.2.1

2.2.0

Was this page helpful?
We use this feedback to improve our documentation.
© 2026 AtlassianTrademark, (opens new window)Privacy, (opens new window)License