Skip to content

Commit

Permalink
refactor: reset page link module
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Dec 12, 2021
1 parent 2f66c75 commit 6f68e8d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,11 @@ figcaption {
}

a {
color: #1abc9c
color: #1abc9c;
}

span.page-link > span {
color: #1abc9c;
}

a:focus,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,10 @@ export class QuakeRender {
break;
}
case 'page_link': {
out += `<a href='#'>${token.raw}</a>`;
out += `<span class='page-link'>
<span id=${'page-link-' + token.entry_type + '-' + token.entry_id}>${token.entry_title}</span>
</span>
`;
break;
}
default: {
Expand Down
5 changes: 4 additions & 1 deletion quake_webapp/quake-render/src/utils/quake-down.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,15 @@ class QuakeDown {
name: 'page_link',
level: 'inline',
tokenizer(src, _tokens) {
const rule = /^\[\[(.*)\]\]/;
const rule = /^\[\[([a-zA-Z_-]{1,}):(\d{1,4})-(.+?(?=\]\]))\]\]/;
const match = rule.exec(src);
if (match) {
return {
type: 'page_link',
raw: match[0],
entry_type: match[1].trim(),
entry_id: match[2].trim(),
entry_title: match[3].trim()
};
}
},
Expand Down

0 comments on commit 6f68e8d

Please sign in to comment.