Skip to content

Commit

Permalink
Render code snippets that are not links
Browse files Browse the repository at this point in the history
  • Loading branch information
neominik authored and KronicDeth committed May 1, 2024
1 parent f79362f commit 2818584
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 2 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Changelog

## v17
## v17.0.1

### Bug Fixes
* [#3491](https://github.com/KronicDeth/intellij-elixir/pull/3491) - [neominik](https://github.com/neominik)
* Render code snippets that are not links.

## v17.0.0

### Breaking changes
* [#3500](https://github.com/KronicDeth/intellij-elixir/pull/3500) - [@KronicDeth](https://github.com/KronicDeth)
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Available idea versions:
# https://www.jetbrains.com/intellij-repository/releases
# https://www.jetbrains.com/intellij-repository/snapshots
baseVersion=17.0.0
baseVersion=17.0.1
ideaVersion=2023.3
# MUST stay at 1.8 for JPS (Build/Compile Project) compatibility even if JRE/JBR is newer
javaVersion=17
Expand Down
9 changes: 9 additions & 0 deletions resources/META-INF/changelog.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<html>
<body>
<h1>v17.0.1</h1>
<ul>
<li>
<p>Bug Fixes</p>
<ul>
<li>Render code snippets that are not links.</li>
</ul>
</li>
</ul>
<h1>v17.0.0</h1>
<ul>
<li>
Expand Down
20 changes: 20 additions & 0 deletions src/org/elixir_lang/documentation/MarkdownFlavourDescriptor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@ import org.intellij.markdown.parser.LinkMap
import java.util.regex.Pattern

class MarkdownFlavourDescriptor(private val project: Project) : GFMFlavourDescriptor() {
fun renderGenericCode(
gfmHtmlGeneratingProvider: GeneratingProvider?,
visitor: HtmlGenerator.HtmlGeneratingVisitor,
text: String,
node: ASTNode
) {
visitor.consumeTagOpen(
node,
"code",
)
gfmHtmlGeneratingProvider!!.processNode(visitor, text, node)
visitor.consumeTagClose("code")
}

override fun createHtmlGeneratingProviders(linkMap: LinkMap, baseURI: URI?): Map<IElementType, GeneratingProvider> =
super
.createHtmlGeneratingProviders(linkMap, baseURI)
Expand Down Expand Up @@ -73,6 +87,8 @@ class MarkdownFlavourDescriptor(private val project: Project) : GFMFlavourDescri
)
gfmHtmlGeneratingProvider!!.processNode(visitor, text, node)
visitor.consumeTagClose("a")
} else {
renderGenericCode(gfmHtmlGeneratingProvider, visitor, text, node)
}
}
5 -> {
Expand Down Expand Up @@ -103,11 +119,15 @@ class MarkdownFlavourDescriptor(private val project: Project) : GFMFlavourDescri
)
gfmHtmlGeneratingProvider!!.processNode(visitor, text, node)
visitor.consumeTagClose("a")
} else {
renderGenericCode(gfmHtmlGeneratingProvider, visitor, text, node)
}
}
}
else -> renderGenericCode(gfmHtmlGeneratingProvider, visitor, text, node)
}
}
else -> renderGenericCode(gfmHtmlGeneratingProvider, visitor, text, node)
}
}
}
Expand Down

0 comments on commit 2818584

Please sign in to comment.