Skip to content

Commit 9c2f670

Browse files
committed
Replace text on new CodeView
1 parent d82f949 commit 9c2f670

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Components/Sources/Components/MarkdownPostView/Blocks/CodeBlockView.swift renamed to Components/Sources/Components/MarkdownPostView/Blocks/CodeBlockView/CodeBlockView.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,20 @@ extension Markdown {
2121
// MARK: - View
2222

2323
var body: some View {
24-
if case let .codeBlock(_, code) = unit.type {
25-
content(code: code)
24+
switch unit.type {
25+
case let .codeBlock(codeType, code):
26+
content(codeType: codeType, code: code)
27+
default:
28+
EmptyView()
2629
}
2730
}
2831

2932
// MARK: - View methods
3033

31-
func content(code: String) -> some View {
34+
func content(codeType: String?, code: String) -> some View {
3235
ScrollView(.horizontal, showsIndicators: true) {
3336
VStack(alignment: .center, spacing: .zero) {
34-
Text(code)
35-
.font(.custom("Menlo-Regular", size: 13))
36-
.foregroundColor(.foreground)
37-
.fixedSize(horizontal: false, vertical: true)
37+
CodeView(codeType: codeType, code: code)
3838
}
3939
}
4040
.padding([.leading, .top, .trailing], 12)

0 commit comments

Comments
 (0)