Skip to content

Commit

Permalink
feat: migrate emphasis (#12963)
Browse files Browse the repository at this point in the history
| 📖 [PR App][pr] | 🎫 Resolve CX-1135, RM-11085 |
| :-------------: | :-----------------: |

## 🧰 Changes

Fixes incompatable emphasis during the migration.

I [fixed this](#988) in
`@readme/mdx`, but I think it'll be nicer to keep the migration specific
stuff in the main app.

## 💁 Customer Impact

<!-- PLEASE DESCRIBE IF THIS CHANGE AFFECTS CUSTOMERS AND HOW -->
<!-- This is extremely useful for Tony and Marc writing the changelog!
-->

## 🧬 QA & Testing

- [ ] insert the string `*the recommended initial action is to**initiate
a[reversal operation
(rollback)](https://docs.jupico.com/reference/ccrollback)**. *` into a
page
- [ ] note the bold and italics
- [ ] migrate the project
- [ ] confirm that the bold and italics render the same in the dash and
hub

<!-- -->

- [Broken on next][next].
- [Working in this PR][pr]!

[next]: https://next.readme.ninja
[pr]: https://readme-pr-12963.readme.ninja
[ui]: https://readme-pr-12963.readme.ninja/ui

<!-- Uncomment and unescape this if you don't want a PR app! -->
<!-- \[skip preview\] -->
  • Loading branch information
kellyjosephprice authored Oct 11, 2024
1 parent 31d14c4 commit fcb1a36
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
36 changes: 36 additions & 0 deletions emphasis.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import * as rmdx from '@readme/mdx';

import { compatParser as mdast } from '@readme/backend/models/project/lib/migrateMdx/compatParser';

describe('migrating emphasis', () => {
it('trims whitespace surrounding phrasing content (emphasis, strong, etc)', () => {
const md = '** bold ** and _ italic _ and *** bold italic ***';

const mdx = rmdx.mdx(mdast(md));
expect(mdx).toMatchInlineSnapshot(`
"**bold** and *italic* and ***bold italic***
"
`);
});

it('moves whitespace surrounding phrasing content (emphasis, strong, etc) to the appropriate place', () => {
const md = '**bold **and also_ italic_ and*** bold italic***aaaaaah';

const mdx = rmdx.mdx(mdast(md));
expect(mdx).toMatchInlineSnapshot(`
"**bold** and also *italic* and ***bold italic***aaaaaah
"
`);
});

it('migrates a complex case', () => {
const md =
'*the recommended initial action is to**initiate a[reversal operation (rollback)](https://docs.jupico.com/reference/ccrollback)**. *';

const mdx = rmdx.mdx(mdast(md));
expect(mdx).toMatchInlineSnapshot(`
"*the recommended initial action is to**initiate a[reversal operation (rollback)](https://docs.jupico.com/reference/ccrollback)**.*
"
`);
});
});
2 changes: 1 addition & 1 deletion tables.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as rmdx from '@readme/mdx';

import { rdmdCompatParser as mdast } from '@readme/backend/models/project/lib/migrateMdx/rdmdCompatParser';
import { compatParser as mdast } from '@readme/backend/models/project/lib/migrateMdx/compatParser';

describe('mdx migration of tables', () => {
it('compiles tables with newlines and inline code', () => {
Expand Down

0 comments on commit fcb1a36

Please sign in to comment.