Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Oct 11, 2022. It is now read-only.

Allow custom inline style matcher #94

Open
dino115 wants to merge 8 commits into withspectrum:master
base: master
Choose a base branch
Loading
from dino115:feature/customInlineStyleMatchers

Conversation

Copy link

@dino115 dino115 commented Jun 23, 2018

Hi,
first of all, thank you very much for your great work!

For my project i have to change the inline style handlers, because up to now we have used a slightly different markdown syntax. I.e. ** for bold, * for italic, and _ for underline and i have to add some additional inline styles.

So i quickly added a configuration for custom inline style matchers. You can use it in the following way:

const markdownPlugin = createMarkdownPlugin({
 customInlineMatchers: {
 BOLD: [/\*\*(.+)\*\*\s$/g, /__(.+)__\s$/g],
 ITALIC: [/\*(.+)\*\s$/g],
 UNDERLINE: [/_(.+)_\s$/g],
 CODE: [/`([^`]+)`\s$/g],
 STRIKETHROUGH: [/~~([^~]+)~~\s$/g],
 MARK: [/==(.+)==\s$/g],
 },
 features: {
 inline: [
 'BOLD',
 'ITALIC',
 'UNDERLINE',
 'CODE',
 'STRIKETHROUGH',
 'MARK',
 ],
 },
});

What do you think about this?

Copy link
Author

dino115 commented Jun 25, 2018

Update: I've added the ability to wait for a whitespace character after the markdown applies a style to the text. To use this, you have to group the ending whitespace in the regular expression.

This is neccessary if you will use the same char in different styles. I.e. ** for bold and * for italic.

BOLD: [/\*\*(.+)\*\*(\s)$/g],
ITALIC: [/\*(.+)\*(\s)$/g],

@dino115 dino115 force-pushed the feature/customInlineStyleMatchers branch from 61e835b to 2350fb0 Compare June 25, 2018 15:18
@dino115 dino115 force-pushed the feature/customInlineStyleMatchers branch from 2350fb0 to 60407de Compare June 25, 2018 16:24
Copy link

mxstbr commented Jul 5, 2018

Sorry for the slow response here—I see where you're going with this and why it'd be use, but I'm not sure I'm ready to maintain all this code we don't use 😕 I'm afraid it'll grow stale and buggy, and it won't be a good experience.

Rosey reacted with thumbs up emoji

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /