mbien commented on code in PR #9240:
URL: https://github.com/apache/netbeans/pull/9240#discussion_r2889341429


##########
ide/markdown/src/org/netbeans/modules/markdown/StyleUtils.java:
##########
@@ -0,0 +1,119 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.markdown;
+
+import java.awt.Color;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import javax.swing.text.AttributeSet;
+import javax.swing.text.StyleConstants;
+import javax.swing.text.html.StyleSheet;
+import org.netbeans.api.editor.mimelookup.MimeLookup;
+import org.netbeans.api.editor.mimelookup.MimePath;
+import org.netbeans.modules.editor.settings.storage.api.EditorSettings;
+import org.netbeans.api.editor.settings.FontColorSettings;
+import 
org.netbeans.modules.editor.settings.storage.api.FontColorSettingsFactory;
+import org.openide.util.NbBundle;
+
+/**
+ *
+ * @author bhaidu
+ */
+public class StyleUtils {
+
+    private static final Map<String, String> fontConfig2tagMapping = new 
HashMap<String, String>() {
+        {
+            put("body", "body");
+            put("code", "code");
+            put("pre", "pre");
+            put("heading1", "h1, h1 a");
+            put("heading2", "h2, h2 a");
+            put("heading3", "h3, h3 a");
+            put("heading4", "h4, h4 a");
+            put("heading5", "h5, h5 a");
+            put("heading6", "h6, h6 a");
+        }
+    };
+
+    public static void addNbSyles(StyleSheet ss) {
+        String profile = 
EditorSettings.getDefault().getCurrentFontColorProfile();
+        String defaultRules = NbBundle.getMessage(StyleUtils.class, 
"CSS_DEFAULT");
+        ss.addRule(defaultRules); 
+        FontColorSettings fcs = 
(MimeLookup.getLookup(MimePath.get(MarkdownDataObject.MIME_TYPE)).lookup(FontColorSettings.class));
+        AttributeSet defaultAttributes = fcs.getFontColors("default"); // 
NOI18N
+        FontColorSettingsFactory fcsf = 
EditorSettings.getDefault().getFontColorSettings(new 
String[]{MarkdownDataObject.MIME_TYPE});
+        Collection<AttributeSet> attributes = fcsf.getAllFontColors(profile);
+        Iterator<AttributeSet> attributesIt = attributes.iterator();
+        while (attributesIt.hasNext()) {
+            AttributeSet attributeSet = attributesIt.next();
+            Enumeration<?> en = attributeSet.getAttributeNames();
+
+            while (en.hasMoreElements()) {
+                Object key = en.nextElement();
+
+                if (key instanceof StyleConstants) {
+                    addRule(ss, attributeSet, defaultAttributes);
+                }
+            }
+        }
+    }
+
+    public static void addRule(StyleSheet ss, AttributeSet attributeSet, 
AttributeSet defaultAttributes) {
+        String nameAttr = (String) 
attributeSet.getAttribute(StyleConstants.NameAttribute);
+        StringBuilder cssRule = new StringBuilder();

Review Comment:
   nitpick: move line below `if`-block



##########
ide/markdown/src/org/netbeans/modules/markdown/resources/coloring.md:
##########


Review Comment:
   this looks like you renamed this file but git thinks you added a copy of it?
   
   orig is at: 
`ide/markdown/src/org/netbeans/modules/markdown/resources/Template.md`
   
   If this  was copied by mistake: better check if you have any staged or 
uncommitted changes.



##########
ide/markdown/src/org/netbeans/modules/markdown/StyleUtils.java:
##########
@@ -0,0 +1,119 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.markdown;
+
+import java.awt.Color;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import javax.swing.text.AttributeSet;
+import javax.swing.text.StyleConstants;
+import javax.swing.text.html.StyleSheet;
+import org.netbeans.api.editor.mimelookup.MimeLookup;
+import org.netbeans.api.editor.mimelookup.MimePath;
+import org.netbeans.modules.editor.settings.storage.api.EditorSettings;
+import org.netbeans.api.editor.settings.FontColorSettings;
+import 
org.netbeans.modules.editor.settings.storage.api.FontColorSettingsFactory;
+import org.openide.util.NbBundle;
+
+/**
+ *
+ * @author bhaidu
+ */
+public class StyleUtils {
+
+    private static final Map<String, String> fontConfig2tagMapping = new 
HashMap<String, String>() {
+        {
+            put("body", "body");

Review Comment:
   nitpick: this looks read-only to me. Would be a candidate for `Map.of()` 
which allows up to 10 elements. (`Map.ofEntries()` in case there would be more)



##########
ide/libs.flexmark/nbproject/project.properties:
##########
@@ -15,6 +15,23 @@
 # specific language governing permissions and limitations
 # under the License.
 
+file.reference.flexmark-0.64.8.jar=external/flexmark-0.64.8.jar
+file.reference.flexmark-ext-anchorlink-0.64.8.jar=external/flexmark-ext-anchorlink-0.64.8.jar
+file.reference.flexmark-ext-emoji-0.64.8.jar=external/flexmark-ext-emoji-0.64.8.jar
+file.reference.flexmark-ext-gfm-tasklist-0.64.8.jar=external/flexmark-ext-gfm-tasklist-0.64.8.jar
+file.reference.flexmark-ext-tables-0.64.8.jar=external/flexmark-ext-tables-0.64.8.jar
+file.reference.flexmark-html2md-converter-0.64.8.jar=external/flexmark-html2md-converter-0.64.8.jar
+file.reference.flexmark-util-ast-0.64.8.jar=external/flexmark-util-ast-0.64.8.jar
+file.reference.flexmark-util-builder-0.64.8.jar=external/flexmark-util-builder-0.64.8.jar
+file.reference.flexmark-util-collection-0.64.8.jar=external/flexmark-util-collection-0.64.8.jar
+file.reference.flexmark-util-data-0.64.8.jar=external/flexmark-util-data-0.64.8.jar
+file.reference.flexmark-util-dependency-0.64.8.jar=external/flexmark-util-dependency-0.64.8.jar
+file.reference.flexmark-util-format-0.64.8.jar=external/flexmark-util-format-0.64.8.jar
+file.reference.flexmark-util-html-0.64.8.jar=external/flexmark-util-html-0.64.8.jar
+file.reference.flexmark-util-misc-0.64.8.jar=external/flexmark-util-misc-0.64.8.jar
+file.reference.flexmark-util-sequence-0.64.8.jar=external/flexmark-util-sequence-0.64.8.jar
+file.reference.flexmark-util-visitor-0.64.8.jar=external/flexmark-util-visitor-0.64.8.jar
+file.reference.jsoup-1.15.4.jar=external/jsoup-1.15.4.jar

Review Comment:
   did NB generate those?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to