Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I create a pattern for multiple lines? #60

Open
trueberryless opened this issue Nov 13, 2023 · 2 comments
Open

How can I create a pattern for multiple lines? #60

trueberryless opened this issue Nov 13, 2023 · 2 comments

Comments

@trueberryless
Copy link

I absolutely have to create a RegEx pattern which checks for code blocks in my markdown code (and inline code as well):

# Markdown Code Blocks
`{1,3}[\s\S]+?`{1,3}

However, I know that patterns.txt only runs RegEx against single lines, I am completely lost on how to check for code blocks. I don't wanna through all unrecognized words into allow.txt cause it's just too many and moreover, they change all the time...

Is there another solution on how to ignore those parts of the markdown? I have read in your docs but I don't understand the meaning of this page, so please may somebody explain what I can do...

If there currently is none, could you please add an option to the Action which says: run RegEx against whole file as one single string?

@jsoref
Copy link
Member

jsoref commented Nov 13, 2023

There currently isn't support for such a thing yet, that page is me jotting down ideas for how I might implement it. Sorry :(. -- I've tried to update the page to clarify that it's a thing I'm planning as opposed to a thing that's implemented.

You could change the workflow so that it:

  1. uses: actions/checkout@...
  2. run: ... -- a thing which does some preprocessing of .md files (or similar) -- probably replacing the line with `` (you don't want to mess up the line offsets, because that'll confuse reporting for later lines). Sorry, I don't have sample code for you -- as soon as I have it, it'll be in @prerelease .
  3. uses: check-spelling/check-spelling@...

Conceptually, whatever I end up doing will work fairly close to this.

It's pretty cool to see that you're using check-spelling for German content -- it seems like you got it to work (I believe you're the first user I've seen who just put it in place).

@trueberryless
Copy link
Author

Okay, thank you very much for your quick response!

If you want an example of a code block, here you go (it's one of many from my site):

[Function("MyTimerTrigger")]
public static string Run(
	[TimerTrigger("*/10 * * * * *")] MyInfo myTimer,
	FunctionContext context)
{
	var logger = context.GetLogger("RecurringEvent");
	logger.LogInformation(
		$"Function executed at: {DateTime.Now}");
}

Wait, I'm the first person who uses German check-spelling? That wasn't that hard, I just used your dictionary... But thx I guess!

I'm looking forward to anything happening in this kind of direction (sry, I'm not good at English, lol)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants