mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-12-22 23:58:47 +01:00
Fix lints and add changelog.d entry
This commit is contained in:
parent
cf1a93839f
commit
0a498bee38
1
changelog.d/2133.feature
Normal file
1
changelog.d/2133.feature
Normal file
@ -0,0 +1 @@
|
||||
Add labs support for rendering LaTeX maths (MSC2191)
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020 New Vector Ltd
|
||||
* Copyright (c) 2021 The Matrix.org Foundation C.I.C.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -21,4 +21,4 @@ class DisplayMaths(private val delimiter: DisplayDelimiter) : CustomBlock() {
|
||||
enum class DisplayDelimiter {
|
||||
DOUBLE_DOLLAR, SQUARE_BRACKET_ESCAPED
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020 New Vector Ltd
|
||||
* Copyright (c) 2021 The Matrix.org Foundation C.I.C.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020 New Vector Ltd
|
||||
* Copyright (c) 2021 The Matrix.org Foundation C.I.C.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020 New Vector Ltd
|
||||
* Copyright (c) 2021 The Matrix.org Foundation C.I.C.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020 New Vector Ltd
|
||||
* Copyright (c) 2021 The Matrix.org Foundation C.I.C.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020 New Vector Ltd
|
||||
* Copyright (c) 2021 The Matrix.org Foundation C.I.C.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -29,4 +29,4 @@ abstract class MathsNodeRenderer : NodeRenderer {
|
||||
types.add(DisplayMaths::class.java)
|
||||
return types
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -51,8 +51,12 @@ class EventHtmlRenderer @Inject constructor(htmlConfigure: MatrixHtmlPluginConfi
|
||||
.usePlugin(object : AbstractMarkwonPlugin() { // Markwon expects maths to be in a specific format: https://noties.io/Markwon/docs/v4/ext-latex
|
||||
override fun processMarkdown(markdown: String): String {
|
||||
return markdown
|
||||
.replace(Regex("""<span\s+data-mx-maths="([^"]*)">.*?</span>""")) { matchResult -> "$$" + matchResult.groupValues[1] + "$$" }
|
||||
.replace(Regex("""<div\s+data-mx-maths="([^"]*)">.*?</div>""")) { matchResult -> "\n$$\n" + matchResult.groupValues[1] + "\n$$\n" }
|
||||
.replace(Regex("""<span\s+data-mx-maths="([^"]*)">.*?</span>""")) {
|
||||
matchResult -> "$$" + matchResult.groupValues[1] + "$$"
|
||||
}
|
||||
.replace(Regex("""<div\s+data-mx-maths="([^"]*)">.*?</div>""")) {
|
||||
matchResult -> "\n$$\n" + matchResult.groupValues[1] + "\n$$\n"
|
||||
}
|
||||
}
|
||||
})
|
||||
.usePlugin(MarkwonInlineParserPlugin.create())
|
||||
|
Loading…
Reference in New Issue
Block a user