Skip to content

Commit

Permalink
feat: enable ==mark== syntax (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
cqroot committed Apr 11, 2023
1 parent b448e74 commit ab1e611
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '16.x'

- run: npm install

Expand Down
11 changes: 11 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"dependencies": {
"katex": "^0.16.2",
"markdown-it": "^13.0.1",
"markdown-it-mark": "^3.0.1",
"uslug": "git+https://github.com/laurent22/uslug.git#emoji-support"
},
"files": [
Expand Down
14 changes: 14 additions & 0 deletions src/markdownHeaders.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,17 @@ test('headers after code highlighting', () => {
slug: 'header-3',
});
});

test('headers after code highlighting', () => {
const headers = markdownHeaders(
readFileSync('./test/markdownHeaders_79.md', 'utf-8'),
);
expect(headers.length).toBe(1);
expect(headers[0]).toEqual({
html: '<mark>Like <strong>this</strong></mark>',
level: 1,
lineno: 0,
number: '1',
slug: 'like-this',
});
});
3 changes: 2 additions & 1 deletion src/markdownHeaders.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import getSlug from './markdownSlug';

const katex = require('katex');
const markdownit = require('markdown-it')({ html: true });
const markdownit = require('markdown-it')({ html: true })
.use(require('markdown-it-mark'));

function isHeader(line: string, context: any) {
// check code block
Expand Down
1 change: 1 addition & 0 deletions test/markdownHeaders_79.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# ==Like **this**==

0 comments on commit ab1e611

Please sign in to comment.